From 13a7e1db7b7a32be658849dc949929a93e601071 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 4 May 2023 13:04:03 -0400 Subject: [PATCH] MT#55283 add codec_touched_real() Simply stripping a supplemental codec doesn't actually affect the remaining real codecs. Add a special-cased version of codec_touched() to ignore such a manipulation. Add a matching test case. Change-Id: I4a91292dd38e1114837c2dc841afe07d87cff6cb --- daemon/codec.c | 11 ++++++-- t/auto-daemon-tests.pl | 59 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index 8ef03c059..3884f335b 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -4536,6 +4536,13 @@ static struct codec_tracker *codec_tracker_init(void) { return NULL; #endif } +static void codec_touched_real(struct codec_store *cs, struct rtp_payload_type *pt) { +#ifdef WITH_TRANSCODING + if (pt->codec_def && pt->codec_def->supplemental) + return; + g_hash_table_replace(cs->tracker->touched, GUINT_TO_POINTER(pt->clock_rate), (void *) 0x1); +#endif +} static void codec_touched(struct codec_store *cs, struct rtp_payload_type *pt) { #ifdef WITH_TRANSCODING if (pt->codec_def && pt->codec_def->supplemental) { @@ -4917,7 +4924,7 @@ void codec_store_strip(struct codec_store *cs, GQueue *strip, GHashTable *except " (%i) due to strip=all or strip=full", STR_FMT(&pt->encoding_with_params), pt->payload_type); - codec_touched(cs, pt); + codec_touched_real(cs, pt); next = __codec_store_delete_link(link, cs); } link = next; @@ -4938,7 +4945,7 @@ void codec_store_strip(struct codec_store *cs, GQueue *strip, GHashTable *except if (pt) { ilogs(codec, LOG_DEBUG, "Stripping codec " STR_FORMAT " (%i)", STR_FMT(&pt->encoding_with_params), pt_num); - codec_touched(cs, pt); + codec_touched_real(cs, pt); __codec_store_delete_link(pt->prefs_link, cs); // this removes pts->head } diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 1e6b6afe0..98f8a2340 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -18588,6 +18588,65 @@ SDP +new_call; + +offer('strip CN', + { ICE => 'remove', replace => ['origin'], + codec => { strip => [qw/PCMU RED CN G729/]} }, < 'remove', replace => ['origin'],