Skip to content

Commit 40a98c5

Browse files
committed
MT#55283 stricter asymmetric codecs
Don't blindly take over a source DTMF PT if one is present. Check if the destination has _some_ DTMF PT, and only then take over the source. This makes the behaviour more closely match the documentation. One test is affected and seems to improve its outcome. Closes #2091 Change-Id: Ibb9c1f79099fa30ac69ec71b4a4c71af0b88b327
1 parent 3d735cd commit 40a98c5

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

daemon/codec.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,10 +1655,16 @@ sink_pt_fixed:;
16551655
rtp_payload_type *sink_cn_pt = __supp_payload_type(supplemental_sinks,
16561656
sink_pt->clock_rate, "CN");
16571657
if (a.allow_asymmetric) {
1658-
if (!sink_dtmf_pt || (src_dtmf_pt && !rtp_payload_type_fmt_cmp(sink_dtmf_pt, src_dtmf_pt)))
1659-
sink_dtmf_pt = src_dtmf_pt;
1660-
if (!sink_cn_pt || (src_cn_pt && !rtp_payload_type_fmt_cmp(sink_cn_pt, src_cn_pt)))
1661-
sink_cn_pt = src_cn_pt;
1658+
if (src_dtmf_pt && (!sink_dtmf_pt || !rtp_payload_type_fmt_cmp(sink_dtmf_pt, src_dtmf_pt))) {
1659+
rtp_payload_type *compat = codec_store_find_compatible(&sink->codecs, src_dtmf_pt);
1660+
if (compat)
1661+
sink_dtmf_pt = src_dtmf_pt;
1662+
}
1663+
if (src_cn_pt && (!sink_cn_pt || !rtp_payload_type_fmt_cmp(sink_cn_pt, src_cn_pt))) {
1664+
rtp_payload_type *compat = codec_store_find_compatible(&sink->codecs, src_cn_pt);
1665+
if (compat)
1666+
sink_cn_pt = src_cn_pt;
1667+
}
16621668
}
16631669
rtp_payload_type *real_sink_dtmf_pt = NULL; // for DTMF delay
16641670

t/auto-daemon-tests.pl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7390,10 +7390,9 @@ sub stun_succ {
73907390
o=- 1545997027 1 IN IP4 198.51.100.11
73917391
s=tester
73927392
t=0 0
7393-
m=audio PORT RTP/AVP 8 97
7393+
m=audio PORT RTP/AVP 8
73947394
c=IN IP4 203.0.113.1
73957395
a=rtpmap:8 PCMA/8000
7396-
a=rtpmap:97 telephone-event/8000
73977396
a=sendrecv
73987397
a=rtcp:PORT
73997398
SDP

0 commit comments

Comments
 (0)