Skip to content

Commit e030aaa

Browse files
committed
MT#60347 fix fringe DTMF payload type case
Change-Id: I2fbb659c445ec9733b87f01d75e38c50e69caf3a (cherry picked from commit d799c66)
1 parent 42adac2 commit e030aaa

File tree

2 files changed

+78
-4
lines changed

2 files changed

+78
-4
lines changed

daemon/codec.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5423,8 +5423,12 @@ void __codec_store_answer(struct codec_store *dst, struct codec_store *src, stru
54235423
// handle associated supplemental codecs
54245424
if (h->cn_payload_type != -1) {
54255425
pt = g_hash_table_lookup(orig_dst.codecs, GINT_TO_POINTER(h->cn_payload_type));
5426-
if (!pt && a.allow_asymmetric)
5427-
pt = g_hash_table_lookup(src->codecs, GINT_TO_POINTER(h->cn_payload_type));
5426+
if (a.allow_asymmetric) {
5427+
struct rtp_payload_type *src_pt
5428+
= g_hash_table_lookup(src->codecs, GINT_TO_POINTER(h->cn_payload_type));
5429+
if (src_pt && (!pt || !rtp_payload_type_eq_compat(src_pt, pt)))
5430+
pt = src_pt;
5431+
}
54285432
if (!pt)
54295433
ilogs(codec, LOG_DEBUG, "CN payload type %i is missing", h->cn_payload_type);
54305434
else
@@ -5435,8 +5439,12 @@ void __codec_store_answer(struct codec_store *dst, struct codec_store *src, stru
54355439
dtmf_payload_type = h->real_dtmf_payload_type;
54365440
if (dtmf_payload_type != -1) {
54375441
pt = g_hash_table_lookup(orig_dst.codecs, GINT_TO_POINTER(dtmf_payload_type));
5438-
if (!pt && a.allow_asymmetric)
5439-
pt = g_hash_table_lookup(src->codecs, GINT_TO_POINTER(dtmf_payload_type));
5442+
if (a.allow_asymmetric) {
5443+
struct rtp_payload_type *src_pt
5444+
= g_hash_table_lookup(src->codecs, GINT_TO_POINTER(dtmf_payload_type));
5445+
if (src_pt && (!pt || !rtp_payload_type_eq_compat(src_pt, pt)))
5446+
pt = src_pt;
5447+
}
54405448
if (!pt)
54415449
ilogs(codec, LOG_DEBUG, "DTMF payload type %i is missing", dtmf_payload_type);
54425450
else

t/auto-daemon-tests.pl

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,72 @@ sub stun_succ {
356356
a=rtcp:PORT
357357
SDP
358358

359+
360+
361+
362+
new_call;
363+
364+
offer('duplicate t-e', { codec => {
365+
strip => ['all'],
366+
except => [qw/opus G722 PCMA telephone-event/],
367+
transcode => ['telephone-event'],
368+
} }, <<SDP);
369+
v=0
370+
o=- 1545997027 1 IN IP4 198.51.100.11
371+
s=tester
372+
t=0 0
373+
m=audio 3000 RTP/AVP 127 98 97 9 8 101 102
374+
c=IN IP4 198.51.100.50
375+
a=sendrecv
376+
a=rtpmap:127 EVS/16000/1
377+
a=fmtp:127 evs-mode-switch=0;br=5.9-24.4;bw=nb-wb;cmr=-1;ch-aw-recv=0;max-red=0
378+
a=rtpmap:98 AMR-WB/16000/1
379+
a=fmtp:98 octet-align=0;mode-change-capability=2;max-red=0
380+
a=rtpmap:97 AMR/8000/1
381+
a=fmtp:97 octet-align=0;mode-change-capability=2;max-red=0
382+
a=rtpmap:101 telephone-event/16000
383+
a=rtpmap:102 telephone-event/8000
384+
-------------------------------------------
385+
v=0
386+
o=- 1545997027 1 IN IP4 198.51.100.11
387+
s=tester
388+
t=0 0
389+
m=audio PORT RTP/AVP 9 8 102
390+
c=IN IP4 203.0.113.1
391+
a=rtpmap:9 G722/8000
392+
a=rtpmap:8 PCMA/8000
393+
a=rtpmap:102 telephone-event/8000
394+
a=sendrecv
395+
a=rtcp:PORT
396+
SDP
397+
398+
answer('duplicate t-e', { flags => ['allow asymmetric codecs'] }, <<SDP);
399+
v=0
400+
o=- 1545997027 1 IN IP4 198.51.100.11
401+
s=tester
402+
t=0 0
403+
m=audio 3000 RTP/AVP 8 101
404+
c=IN IP4 198.51.100.50
405+
a=sendrecv
406+
a=rtpmap:8 PCMA/8000
407+
a=rtpmap:101 telephone-event/8000
408+
a=fmtp:101 0-15
409+
-------------------------------------------
410+
v=0
411+
o=- 1545997027 1 IN IP4 198.51.100.11
412+
s=tester
413+
t=0 0
414+
m=audio PORT RTP/AVP 8 101
415+
c=IN IP4 203.0.113.1
416+
a=rtpmap:8 PCMA/8000
417+
a=rtpmap:101 telephone-event/8000
418+
a=fmtp:101 0-15
419+
a=sendrecv
420+
a=rtcp:PORT
421+
SDP
422+
423+
424+
359425
new_call;
360426

361427
offer('mismatched t-p-e with strip/except control', { codec => {

0 commit comments

Comments
 (0)