提交 813a5777 authored 作者: Anthony Minessale's avatar Anthony Minessale

cheat so jingle can use ilbc right

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1202 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 453b85ba
...@@ -218,12 +218,47 @@ static const switch_codec_implementation ilbc_8k_20ms_implementation = { ...@@ -218,12 +218,47 @@ static const switch_codec_implementation ilbc_8k_20ms_implementation = {
}; };
static const switch_codec_implementation ilbc_8k_20ms_nonext_implementation = {
/*.samples_per_second */ 8000,
/*.bits_per_second */ NO_OF_BYTES_20MS*8*8000/BLOCKL_20MS,
/*.microseconds_per_frame */ 20000,
/*.samples_per_frame */ 160,
/*.bytes_per_frame */ 320,
/*.encoded_bytes_per_frame */ NO_OF_BYTES_20MS,
/*.number_of_channels */ 1,
/*.pref_frames_per_packet */ 1,
/*.max_frames_per_packet */ 1,
/*.init */ switch_ilbc_init,
/*.encode */ switch_ilbc_encode,
/*.decode */ switch_ilbc_decode,
/*.destroy */ switch_ilbc_destroy
};
static const switch_codec_interface ilbc_20ms_codec_interface = {
/*.interface_name */ "ilbc",
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 97,
/*.iananame */ "iLBC20ms",
/*.implementations */ &ilbc_8k_20ms_nonext_implementation
};
static const switch_codec_interface ilbc_102_codec_interface = {
/*.interface_name */ "ilbc",
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 102,
/*.iananame */ "iLBC102",
/*.implementations */ &ilbc_8k_20ms_implementation,
/*.next*/ &ilbc_20ms_codec_interface
};
static const switch_codec_interface ilbc_codec_interface = { static const switch_codec_interface ilbc_codec_interface = {
/*.interface_name */ "ilbc", /*.interface_name */ "ilbc",
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, /*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 97, /*.ianacode */ 97,
/*.iananame */ "iLBC", /*.iananame */ "iLBC",
/*.implementations */ &ilbc_8k_20ms_implementation, /*.implementations */ &ilbc_8k_20ms_implementation,
/*.next*/ &ilbc_102_codec_interface
}; };
......
...@@ -224,15 +224,20 @@ static int activate_rtp(struct private_object *tech_pvt) ...@@ -224,15 +224,20 @@ static int activate_rtp(struct private_object *tech_pvt)
{ {
switch_channel *channel = switch_core_session_get_channel(tech_pvt->session); switch_channel *channel = switch_core_session_get_channel(tech_pvt->session);
const char *err; const char *err;
int ms = 20;
if (tech_pvt->rtp_session) { if (tech_pvt->rtp_session) {
return 0; return 0;
} }
if (!strcasecmp(tech_pvt->codec_name, "ilbc")) {
ms = 30;
}
if (switch_core_codec_init(&tech_pvt->read_codec, if (switch_core_codec_init(&tech_pvt->read_codec,
tech_pvt->codec_name, tech_pvt->codec_name,
8000, 8000,
20, ms,
1, 1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
...@@ -248,7 +253,7 @@ static int activate_rtp(struct private_object *tech_pvt) ...@@ -248,7 +253,7 @@ static int activate_rtp(struct private_object *tech_pvt)
if (switch_core_codec_init(&tech_pvt->write_codec, if (switch_core_codec_init(&tech_pvt->write_codec,
tech_pvt->codec_name, tech_pvt->codec_name,
8000, 8000,
20, ms,
1, 1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
...@@ -388,8 +393,6 @@ static int do_describe(struct private_object *tech_pvt, int force) ...@@ -388,8 +393,6 @@ static int do_describe(struct private_object *tech_pvt, int force)
} }
payloads[0].name = tech_pvt->codecs[0]->iananame;
payloads[0].id = tech_pvt->codecs[0]->ianacode;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Describe [%s]\n", payloads[0].name); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Describe [%s]\n", payloads[0].name);
tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, 1, tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, 1,
switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT); switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论