add yucky hacks to make googletalk work with ilbc (shame on them)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1204 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0aab549821
commit
ed53c98d67
|
@ -104,6 +104,7 @@ SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
|||
SWITCH_RTP_FLAG_SECURE - Secure RTP
|
||||
SWITCH_RTP_FLAG_AUTOADJ - Auto-Adjust the dest based on the source
|
||||
SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed
|
||||
SWITCH_RTP_FLAG_GOOGLEHACK - Convert payload from 102 to 97
|
||||
</pre>
|
||||
*/
|
||||
typedef enum {
|
||||
|
@ -112,7 +113,8 @@ typedef enum {
|
|||
SWITCH_RTP_FLAG_USE_TIMER = (1 << 2),
|
||||
SWITCH_RTP_FLAG_SECURE = (1 << 3),
|
||||
SWITCH_RTP_FLAG_AUTOADJ = (1 << 4),
|
||||
SWITCH_RTP_FLAG_RAW_WRITE = (1 << 5)
|
||||
SWITCH_RTP_FLAG_RAW_WRITE = (1 << 5),
|
||||
SWITCH_RTP_FLAG_GOOGLEHACK = (1 << 6)
|
||||
} switch_rtp_flag_t;
|
||||
|
||||
/*!
|
||||
|
|
|
@ -161,7 +161,7 @@ static switch_status switch_ilbc_decode(switch_codec *codec,
|
|||
unsigned int new_len = 0;
|
||||
float buf[240];
|
||||
|
||||
|
||||
printf("WTF %d\n", encoded_data_len);
|
||||
for (x = 0; x < loops && new_len < *decoded_data_len; x++) {
|
||||
iLBC_decode(buf, edp, &context->decoder, 1);
|
||||
for(y = 0; y < context->dbytes / sizeof(short) ; y++) {
|
||||
|
|
|
@ -230,7 +230,7 @@ static int activate_rtp(struct private_object *tech_pvt)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!strcasecmp(tech_pvt->codec_name, "ilbc")) {
|
||||
if (!strncasecmp(tech_pvt->codec_name, "ilbc", 4)) {
|
||||
ms = 30;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ static int activate_rtp(struct private_object *tech_pvt)
|
|||
tech_pvt->codec_num,
|
||||
tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
|
||||
tech_pvt->read_codec.implementation->microseconds_per_frame,
|
||||
SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ,
|
||||
SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_GOOGLEHACK,
|
||||
NULL,
|
||||
&err, switch_core_session_get_pool(tech_pvt->session)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
|
||||
|
@ -357,6 +357,15 @@ static int do_candidates(struct private_object *tech_pvt, int force)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char *lame(char *in)
|
||||
{
|
||||
if (!strncasecmp(in, "ilbc", 4)) {
|
||||
return "iLBC";
|
||||
} else {
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
||||
static int do_describe(struct private_object *tech_pvt, int force)
|
||||
{
|
||||
ldl_payload_t payloads[5];
|
||||
|
@ -380,15 +389,15 @@ static int do_describe(struct private_object *tech_pvt, int force)
|
|||
if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) {
|
||||
if (tech_pvt->codec_index < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n");
|
||||
tech_pvt->codec_name = tech_pvt->codecs[0]->iananame;
|
||||
tech_pvt->codec_name = lame(tech_pvt->codecs[0]->iananame);
|
||||
tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode;
|
||||
tech_pvt->codec_index = 0;
|
||||
|
||||
payloads[0].name = tech_pvt->codecs[0]->iananame;
|
||||
payloads[0].name = lame(tech_pvt->codecs[0]->iananame);
|
||||
payloads[0].id = tech_pvt->codecs[0]->ianacode;
|
||||
|
||||
|
||||
} else {
|
||||
payloads[0].name = tech_pvt->codecs[tech_pvt->codec_index]->iananame;
|
||||
payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->iananame);
|
||||
payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->ianacode;
|
||||
}
|
||||
|
||||
|
@ -695,7 +704,7 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
|
|||
while (!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
|
||||
tech_pvt->read_frame.flags = 0;
|
||||
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame);
|
||||
|
||||
|
||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
|
|
@ -1194,6 +1194,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||
if (need_codec) {
|
||||
if (frame->codec) {
|
||||
session->raw_write_frame.datalen = session->raw_write_frame.buflen;
|
||||
printf("ASS %u\n", frame->datalen);
|
||||
|
||||
status = switch_core_codec_decode(frame->codec,
|
||||
session->write_codec,
|
||||
|
|
|
@ -541,6 +541,9 @@ static int rtp_common_read(switch_rtp *rtp_session, switch_payload_t *payload_ty
|
|||
}
|
||||
|
||||
if (rtp_session->recv_msg.header.version == 2) {
|
||||
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_GOOGLEHACK) && rtp_session->recv_msg.header.pt == 102) {
|
||||
rtp_session->recv_msg.header.pt = 97;
|
||||
}
|
||||
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port &&
|
||||
(rtp_session->from_addr->port != rtp_session->remote_port)) {
|
||||
uint32_t old = rtp_session->remote_port;
|
||||
|
@ -679,6 +682,9 @@ static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datale
|
|||
bytes = sbytes;
|
||||
}
|
||||
|
||||
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_GOOGLEHACK) && rtp_session->send_msg.header.pt == 97) {
|
||||
rtp_session->recv_msg.header.pt = 102;
|
||||
}
|
||||
switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void*)send_msg, &bytes);
|
||||
|
||||
if (rtp_session->ice_user) {
|
||||
|
|
Loading…
Reference in New Issue