提交 77fe0e7b authored 作者: Anthony Minessale's avatar Anthony Minessale

add mode goodies to ilbc

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4348 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a88da362
...@@ -190,7 +190,7 @@ static const switch_codec_implementation_t ilbc_8k_30ms_implementation = { ...@@ -190,7 +190,7 @@ static const switch_codec_implementation_t ilbc_8k_30ms_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, /*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 97, /*.ianacode */ 97,
/*.iananame */ "iLBC", /*.iananame */ "iLBC",
/*.fmtp */ NULL, /*.fmtp */ "mode=30",
/*.samples_per_second */ 8000, /*.samples_per_second */ 8000,
/*.bits_per_second */ NO_OF_BYTES_30MS*8*8000/BLOCKL_30MS, /*.bits_per_second */ NO_OF_BYTES_30MS*8*8000/BLOCKL_30MS,
/*.microseconds_per_frame */ 30000, /*.microseconds_per_frame */ 30000,
...@@ -210,7 +210,7 @@ static const switch_codec_implementation_t ilbc_8k_20ms_implementation = { ...@@ -210,7 +210,7 @@ static const switch_codec_implementation_t ilbc_8k_20ms_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, /*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 97, /*.ianacode */ 97,
/*.iananame */ "iLBC", /*.iananame */ "iLBC",
/*.fmtp */ NULL, /*.fmtp */ "mode=20",
/*.samples_per_second */ 8000, /*.samples_per_second */ 8000,
/*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS, /*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS,
/*.microseconds_per_frame */ 20000, /*.microseconds_per_frame */ 20000,
...@@ -233,7 +233,7 @@ static const switch_codec_implementation_t ilbc_102_8k_30ms_implementation = { ...@@ -233,7 +233,7 @@ static const switch_codec_implementation_t ilbc_102_8k_30ms_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, /*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 102, /*.ianacode */ 102,
/*.iananame */ "iLBC", /*.iananame */ "iLBC",
/*.fmtp */ NULL, /*.fmtp */ "mode=30",
/*.samples_per_second */ 8000, /*.samples_per_second */ 8000,
/*.bits_per_second */ NO_OF_BYTES_30MS*8*8000/BLOCKL_30MS, /*.bits_per_second */ NO_OF_BYTES_30MS*8*8000/BLOCKL_30MS,
/*.microseconds_per_frame */ 30000, /*.microseconds_per_frame */ 30000,
...@@ -253,7 +253,7 @@ static const switch_codec_implementation_t ilbc_102_8k_20ms_implementation = { ...@@ -253,7 +253,7 @@ static const switch_codec_implementation_t ilbc_102_8k_20ms_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, /*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 102, /*.ianacode */ 102,
/*.iananame */ "iLBC102", /*.iananame */ "iLBC102",
/*.fmtp */ NULL, /*.fmtp */ "mode=20",
/*.samples_per_second */ 8000, /*.samples_per_second */ 8000,
/*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS, /*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS,
/*.microseconds_per_frame */ 20000, /*.microseconds_per_frame */ 20000,
...@@ -275,7 +275,7 @@ static const switch_codec_implementation_t ilbc_8k_20ms_nonext_implementation = ...@@ -275,7 +275,7 @@ static const switch_codec_implementation_t ilbc_8k_20ms_nonext_implementation =
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, /*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 97, /*.ianacode */ 97,
/*.iananame */ "iLBC20ms", /*.iananame */ "iLBC20ms",
/*.fmtp */ NULL, /*.fmtp */ "mode=20",
/*.samples_per_second */ 8000, /*.samples_per_second */ 8000,
/*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS, /*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS,
/*.microseconds_per_frame */ 20000, /*.microseconds_per_frame */ 20000,
......
...@@ -809,6 +809,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch ...@@ -809,6 +809,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch
{ {
const switch_codec_interface_t *codec_interface; const switch_codec_interface_t *codec_interface;
const switch_codec_implementation_t *iptr, *implementation = NULL; const switch_codec_implementation_t *iptr, *implementation = NULL;
char *mode = fmtp;
assert(codec != NULL); assert(codec != NULL);
assert(codec_name != NULL); assert(codec_name != NULL);
...@@ -820,6 +821,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch ...@@ -820,6 +821,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
if (mode && strncasecmp(mode, "mode=", 5)) {
int mms;
mode += 5;
if (mode) {
mms = atoi(mode);
if (mms > 0 && mms < 120) {
ms = mms;
}
}
}
/* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */ /* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
if (!ms) { if (!ms) {
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) { for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论