mod_sangoma_codec: ignore cng frames

This commit is contained in:
Moises Silva 2010-10-12 11:58:40 -04:00
parent 70964c3a2c
commit 6e06ba09eb
1 changed files with 19 additions and 4 deletions

View File

@ -476,8 +476,18 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec
break; break;
} }
if (encoded_frame.payload != codec->implementation->ianacode if (encoded_frame.payload == IANACODE_CN) {
&& encoded_frame.payload != IANACODE_CN) { /* confort noise is treated as silence by us */
continue;
}
if (encoded_frame.datalen != codec->implementation->encoded_bytes_per_packet) {
/* seen when silence suppression is enabled */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ignoring encoded frame of %d bytes intead of %d bytes\n", encoded_frame.datalen, codec->implementation->encoded_bytes_per_packet);
continue;
}
if (encoded_frame.payload != codec->implementation->ianacode) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n",
encoded_frame.payload, codec->implementation->ianacode); encoded_frame.payload, codec->implementation->ianacode);
break; break;
@ -657,13 +667,18 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses
break; break;
} }
if (ulaw_frame.payload != IANA_ULAW if (ulaw_frame.payload == IANACODE_CN) {
&& ulaw_frame.payload != IANACODE_CN) { /* confort noise is treated as silence by us */
continue;
}
if (ulaw_frame.payload != IANA_ULAW) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n",
ulaw_frame.payload, IANA_ULAW); ulaw_frame.payload, IANA_ULAW);
break; break;
} }
if (sess->decoder.queue_windex == sess->decoder.queue_rindex) { if (sess->decoder.queue_windex == sess->decoder.queue_rindex) {
if (sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen) { if (sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen) {
/* if there is something where we want to write, we're dropping it */ /* if there is something where we want to write, we're dropping it */