From 036f44ff2f2f7e6c060a18251671e14be83da804 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 77c70d6665f832b82de58f00d6ebc361402bc4b5) --- 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 b4aaf25ec..61951ba26 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -5177,14 +5177,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; } } @@ -5210,6 +5212,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); } @@ -5589,10 +5592,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; };