提交 998a04d2 authored 作者: Anthony Minessale's avatar Anthony Minessale

add 10 20 and 40ms

上级 e7d68a79
...@@ -147,52 +147,43 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, ...@@ -147,52 +147,43 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load) SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
{ {
switch_codec_interface_t *codec_interface; switch_codec_interface_t *codec_interface;
int samples = 80;
int bytes = 960;
int mss = 10000;
int x = 0;
int rate = 48000;
int bits = 32000;
/* connect my internal structure to the blank pointer passed to me */ /* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname); *module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA 0.9.0)"); SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA 0.9.0)");
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ for (x = 0; x < 3; x++) {
115, /* the IANA code number */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
"Opus-0.9.0",/* the IANA code name */ 115, /* the IANA code number */
NULL, /* default fmtp to send (can be overridden by the init function) */ "Opus-0.9.0",/* the IANA code name */
48000, /* samples transferred per second */ NULL, /* default fmtp to send (can be overridden by the init function) */
48000, /* actual samples transferred per second */ rate, /* samples transferred per second */
32000, /* bits transferred per second */ rate, /* actual samples transferred per second */
10000, /* number of microseconds per frame */ bits, /* bits transferred per second */
80, /* number of samples per frame */ mss, /* number of microseconds per frame */
960, /* number of bytes per frame decompressed */ samples, /* number of samples per frame */
0, /* number of bytes per frame compressed */ bytes, /* number of bytes per frame decompressed */
1, /* number of channels represented */ 0, /* number of bytes per frame compressed */
1, /* number of frames per network packet */ 1, /* number of channels represented */
switch_opus_init, /* function to initialize a codec handle using this implementation */ 1, /* number of frames per network packet */
switch_opus_encode, /* function to encode raw data into encoded data */ switch_opus_init, /* function to initialize a codec handle using this implementation */
switch_opus_decode, /* function to decode encoded data into raw data */ switch_opus_encode, /* function to encode raw data into encoded data */
switch_opus_destroy); /* deinitalize a codec handle using this implementation */ switch_opus_decode, /* function to decode encoded data into raw data */
switch_opus_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ bytes *= 2;
115, /* the IANA code number */ samples *= 2;
"Opus-0.9.0", /* the IANA code name */ mss *= 2;
NULL, /* default fmtp to send (can be overridden by the init function) */
48000, /* samples transferred per second */
48000, /* actual samples transferred per second */
32000, /* bits transferred per second */
20000, /* number of microseconds per frame */
160, /* number of samples per frame */
1920, /* number of bytes per frame decompressed */
0, /* number of bytes per frame compressed */
1, /* number of channels represented */
1, /* number of frames per network packet */
switch_opus_init, /* function to initialize a codec handle using this implementation */
switch_opus_encode, /* function to encode raw data into encoded data */
switch_opus_decode, /* function to decode encoded data into raw data */
switch_opus_destroy); /* deinitalize a codec handle using this implementation */
}
/* indicate that the module should continue to be loaded */ /* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论