From d9f25ca10b8cf5945f2787c7e856fe5acb4c1092 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 12 Aug 2025 09:50:08 -0400 Subject: [PATCH] MT#55283 distinguish transcoding PTs PTs that were remembered from a previous handshake to save codec options must be flagged as such so that they're not considered as having been present in the current offer, so that they can be flagged as transcoding PTs. closes #1989 Change-Id: I19c2aff7e83ed338a81be99544645821165304cd (cherry picked from commit f2a9111fb64379c8340c0fcee622512cc057af48) (cherry picked from commit fe164d8a8f47e74311ca287f1441fc9fa7354017) --- daemon/codec.c | 28 ++++++++++++++++++++-------- lib/rtplib.h | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index a4c821155..020e96254 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -5584,14 +5584,16 @@ void __codec_store_populate_reuse(struct codec_store *dst, struct codec_store *s rtp_payload_type *pt = l->data; rtp_payload_type *orig_pt = t_hash_table_lookup(src->codecs, GINT_TO_POINTER(pt->payload_type)); - if(!orig_pt){ - if (a.merge_cs) + if (!orig_pt){ + if (a.merge_cs) { + pt->removed = 1; codec_store_add_raw_link(src, rtp_payload_type_dup(pt), src->codec_prefs.head); + } l = __codec_store_delete_link(l, dst); - }else{ - l = l->next; } + else + l = l->next; } } @@ -5620,6 +5622,7 @@ static void codec_store_merge(struct codec_store *dst, struct codec_store *src) if (old_pt) __codec_store_delete_link(old_pt->prefs_link, dst); + pt->removed = 1; codec_store_add_raw_link(dst, pt, dst->codec_prefs.head); } @@ -6023,10 +6026,19 @@ void codec_store_transcode(struct codec_store *cs, str_q *offer, struct codec_st STR_FMT(codec)); continue; } - ilogs(codec, LOG_DEBUG, "Re-adding stripped codec " STR_FORMAT "/" STR_FORMAT " (%i)", - STR_FMT(&orig_pt->encoding_with_params), - STR_FMT0(&orig_pt->format_parameters), - orig_pt->payload_type); + if (orig_pt->removed) { + ilogs(codec, LOG_DEBUG, "Adding previously present codec " + STR_FORMAT "/" STR_FORMAT " (%i) for transcoding", + STR_FMT(&orig_pt->encoding_with_params), + STR_FMT0(&orig_pt->format_parameters), + orig_pt->payload_type); + orig_pt->for_transcoding = 1; + } + else + ilogs(codec, LOG_DEBUG, "Re-adding stripped codec " STR_FORMAT "/" STR_FORMAT " (%i)", + STR_FMT(&orig_pt->encoding_with_params), + STR_FMT0(&orig_pt->format_parameters), + orig_pt->payload_type); codec_touched(cs, orig_pt); codec_store_add_order(cs, orig_pt); } diff --git a/lib/rtplib.h b/lib/rtplib.h index 1b6138e91..f001b62ae 100644 --- a/lib/rtplib.h +++ b/lib/rtplib.h @@ -118,6 +118,7 @@ struct rtp_payload_type { unsigned int for_transcoding:1; unsigned int accepted:1; + unsigned int removed:1; };