From f1e31694a7d653082da50085173e7cc39d935e19 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 2 Apr 2025 08:30:04 -0400 Subject: [PATCH] MT#55283 fix missing mode-set with reuse-codecs With reuse-codecs, we still need to place the codec from the SDP into our prefs list, even if it's already present, as the format options may have changed. Update one affected test case. Closes #1921 Change-Id: I688c57a8c45ec4c3bf159fe2193a0e00bbceeda2 (cherry picked from commit 65bfe22d407d9616302b4a0b3cc5bf00318d5f79) (cherry picked from commit 5560aa6c26855656bd47cab8417bec2779e7ebe7) --- daemon/codec.c | 7 ++++++- t/auto-daemon-tests.pl | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/codec.c b/daemon/codec.c index 8388b8101..13022b220 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -5138,11 +5138,16 @@ void __codec_store_populate_reuse(struct codec_store *dst, struct codec_store *s pt->reverse_payload_type = pt->payload_type; - if (orig_pt) + if (orig_pt) { ilogs(codec, LOG_DEBUG, "Retaining codec " STR_FORMAT "/" STR_FORMAT " (%i)", STR_FMT(&pt->encoding_with_params), STR_FMT0(&pt->format_parameters), pt->payload_type); + // replace existing entry with new one in same position, + // in case options have changed + __auto_type pos = __codec_store_delete_link(orig_pt->prefs_link, dst); + codec_store_add_raw_link(dst, rtp_payload_type_dup(pt), pos); + } else { if (!a.answer_only) { ilogs(codec, LOG_DEBUG, "Adding codec " STR_FORMAT "/" STR_FORMAT diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 3a3d6b607..df7af54b7 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -3706,6 +3706,7 @@ m=audio PORT RTP/AVP 8 101 c=IN IP4 203.0.113.1 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 a=silenceSupp:off - - - - a=mptime:20 20 - a=sendrecv