From ae5b1762b9f3b572c2c0a39da5acdb0175c0437e Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 12 Aug 2020 14:31:45 -0400 Subject: [PATCH] TT#88603 don't remove transcoded codecs we added ourselves closes #1058 Change-Id: I469b8e71d5a699c948a30cb2171467c267eec741 --- daemon/codec.c | 7 ++- lib/rtplib.h | 2 + t/auto-daemon-tests.pl | 107 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index c0d19ed17..fef965222 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -968,8 +968,10 @@ void codec_handlers_update(struct call_media *receiver, struct call_media *sink, if (MEDIA_ISSET(sink, TRANSCODE)) { // if the other side is transcoding, we may come across a receiver entry // (recv->recv) that wasn't originally offered (recv->send). we must eliminate - // those - if (!g_hash_table_lookup(receiver->codecs_send, &pt->payload_type)) { + // those, unless we added them ourselves for transcoding. + struct rtp_payload_type *recv_pt = + g_hash_table_lookup(receiver->codecs_send, &pt->payload_type); + if (!recv_pt && !pt->for_transcoding) { ilog(LOG_DEBUG, "Eliminating transcoded codec " STR_FORMAT, STR_FMT(&pt->encoding_with_params)); @@ -2382,6 +2384,7 @@ void codec_rtp_payload_types(struct call_media *media, struct call_media *other_ pt = codec_add_payload_type(codec, media); if (!pt) continue; + pt->for_transcoding = 1; if (__codec_synth_transcode_options(pt, flags, media)) continue; diff --git a/lib/rtplib.h b/lib/rtplib.h index 31a8ac6e8..370c24ab6 100644 --- a/lib/rtplib.h +++ b/lib/rtplib.h @@ -29,6 +29,8 @@ struct rtp_payload_type { int bitrate; const codec_def_t *codec_def; + + int for_transcoding:1; }; diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 554ccb042..a13941293 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -36,6 +36,113 @@ my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $resp, +# GH 1058 + +new_call; + +offer('missing codec in re-invite', { + ICE => 'remove', + flags => ["codec-mask-all", "codec-strip-telephone-event", "codec-transcode-PCMU", "codec-transcode-G722", "codec-transcode-t38", "codec-offer-telephone-event", "port-latching"], + 'to-tag' => tt(), + }, < 'remove', + flags => ["trust-address", "symmetric-codecs"], + }, < 'remove', + flags => ["codec-mask-all", "codec-strip-telephone-event", "codec-transcode-PCMU", "codec-transcode-G722", "codec-transcode-t38", "codec-offer-telephone-event", "port-latching"], + 'to-tag' => tt(), + }, <