提交 75d4b560 authored 作者: Mike Jerris's avatar Mike Jerris

Merge pull request #993 in FS/freeswitch from…

Merge pull request #993 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:fix_amr_mode-set_fmtp to master

* commit 'bc851885':
  FS-9613: mod_amr: fix AMR mode bitmap ("mode-set" param in remote fmtp)
...@@ -275,8 +275,12 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ ...@@ -275,8 +275,12 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
} }
} }
/*init to default if there's no "mode-set" param */
context->enc_mode = globals.default_bitrate;
/* choose the highest mode (bitrate) for high audio quality from fmtp "mode-set" param */
/* Note: mode-set = 0 is a valid mode */
if (context->enc_modes) { if (context->enc_modes) {
for (i = 7; i > -1; i++) { for (i = 7; i > -1; i--) {
if (context->enc_modes & (1 << i)) { if (context->enc_modes & (1 << i)) {
context->enc_mode = (switch_byte_t) i; context->enc_mode = (switch_byte_t) i;
break; break;
...@@ -284,15 +288,10 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ ...@@ -284,15 +288,10 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
} }
} }
if (!context->enc_mode) {
context->enc_mode = globals.default_bitrate;
}
switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0,
context->enc_mode); context->enc_mode);
codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp); codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
context->enc_mode = AMR_DEFAULT_BITRATE;
context->encoder_state = NULL; context->encoder_state = NULL;
context->decoder_state = NULL; context->decoder_state = NULL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论