提交 6e06ba09 authored 作者: Moises Silva's avatar Moises Silva

mod_sangoma_codec: ignore cng frames

上级 70964c3a
...@@ -476,8 +476,18 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec ...@@ -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 ...@@ -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 */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论