From fcc792a0d756efa3af2b5aa2d17c5baf05597801 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 12 Mar 2026 14:20:16 -0400 Subject: [PATCH] MT#55283 set media label only for out direction Change-Id: I316ebc34f51adf56d3df715c910e3102ab6e4a86 (cherry picked from commit 0f7774dbfade45a7742aec7e05e803ad3fb6044f) --- daemon/call.c | 27 ++++++++++++--------------- include/call.h | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 1ecd13ba7..0802cf77f 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2846,23 +2846,19 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c #endif } -__attribute__((nonnull(2, 3))) -static void __update_media_label(struct call_media *media, struct call_media *other_media, - sdp_ng_flags *flags) +__attribute__((nonnull(1, 2))) +static void __update_media_label(struct call_media *media, sdp_ng_flags *flags, unsigned int id) { - if (!media) + if (!flags->siprec) + return; + if (flags->opmode != OP_SUBSCRIBE_REQ) + return; + if (media->label.len) return; - if (flags->siprec && flags->opmode == OP_SUBSCRIBE_REQ) { - if (!media->label.len) { - char buf[64]; - snprintf(buf, sizeof(buf), "%u", other_media->unique_id); - media->label = call_str_cpy_c(buf); - } - // put same label on both sides - if (!other_media->label.len) - other_media->label = media->label; - } + char buf[64]; + snprintf(buf, sizeof(buf), "%u", id); + media->label = call_str_cpy_c(buf); } // `media` can be NULL @@ -2927,7 +2923,8 @@ static void __media_init_from_flags(struct call_media *other_media, struct call_ break; } - __update_media_label(media, other_media, flags); + if (media) + __update_media_label(media, flags, other_media->unique_id); __update_media_protocol(media, other_media, sp, flags); __update_media_id(media, other_media, sp, flags); __endpoint_loop_protect(sp, other_media); diff --git a/include/call.h b/include/call.h index 254f95632..7711123cf 100644 --- a/include/call.h +++ b/include/call.h @@ -485,7 +485,7 @@ struct call_media { struct ice_agent *ice_agent; str media_id; - str label; + str label; // outgoing a=label: sdes_q sdes_in, sdes_out; struct dtls_fingerprint fingerprint; /* as received */ const struct dtls_hash_func *fp_hash_func; /* outgoing */