MT#55283 fix `single-codec` with odd codec order

Usually supplemental RTP types (DTMF) are listed after the primary audio
codecs. In the case of the order being reversed, fix `single-codec` so
that it doesn't strip the actual audio codec that is listed after the
DTMF type.

Change-Id: I1b03b89e31bebf4de303b643dcf08d2ffb90ebaf
pull/1577/head
Richard Fuchs 3 years ago
parent 919e3d14ba
commit 40b4d571fe

@ -4833,6 +4833,11 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct
struct rtp_payload_type *pt = l->data;
struct codec_handler *h = codec_handler_get(src_media, pt->payload_type, dst_media, NULL);
bool is_supp = false;
if (pt->codec_def && pt->codec_def->supplemental)
is_supp = true;
if (!h || h->dest_pt.payload_type == -1) {
// passthrough or missing
if (pt->for_transcoding)
@ -4846,8 +4851,9 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct
" (%i) is passthrough",
STR_FMT(&pt->encoding_with_params),
pt->payload_type);
if (!is_supp)
num_codecs++;
codec_store_add_end(dst, pt);
num_codecs++;
}
else
ilogs(codec, LOG_DEBUG, "Skipping passthrough codec " STR_FORMAT
@ -4859,9 +4865,7 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct
}
// supp codecs are handled in-line with their main media codecs
bool is_supp = false;
if (pt->codec_def && pt->codec_def->supplemental) {
is_supp = true;
if (is_supp) {
if (pt->for_transcoding)
continue;
if (is_codec_touched(dst, pt))
@ -4893,7 +4897,8 @@ void codec_store_answer(struct codec_store *dst, struct codec_store *src, struct
codec_store_add_end(dst, pt);
else
codec_store_add_end(dst, &h->dest_pt);
num_codecs++;
if (!is_supp)
num_codecs++;
}
// handle associated supplemental codecs

@ -7652,6 +7652,65 @@ SDP
new_call;
offer('single-codec w telephone-event in wrong order', {
ICE => 'remove',
flags => [],
}, <<SDP);
v=0
o=Z 58440449 0 IN IP4 192.168.1.1
s=Z
c=IN IP4 192.168.1.1
t=0 0
m=audio 8000 RTP/AVP 101 8 0
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
--------------------------------------
v=0
o=Z 58440449 0 IN IP4 192.168.1.1
s=Z
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 101 8 0
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('single-codec w telephone-event in wrong order', {
ICE => 'remove',
flags => ['single codec'],
}, <<SDP);
v=0
o=Z 58440449 0 IN IP4 192.168.1.1
s=Z
c=IN IP4 192.168.1.1
t=0 0
m=audio 8000 RTP/AVP 101 8
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
--------------------------------------
v=0
o=Z 58440449 0 IN IP4 192.168.1.1
s=Z
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 101 8
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
new_call;

Loading…
Cancel
Save