From 400474ede90fd18b801299415fd8b5f0d54ea4ea Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 18 Feb 2026 11:00:29 -0400 Subject: [PATCH] MT#55283 split out media_gen_media_id Change-Id: Ib34d2b8416b78e41e8acf33ff93777d53bf1faaa (cherry picked from commit bc85945a5990a032bef09b513b3daaca0207e3bb) (cherry picked from commit b68d247e95755261e83dc161a28f38f54bedbcf0) --- daemon/call.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 0b9b1196b..61f4e77cd 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2313,12 +2313,20 @@ static void media_answer_media_id(struct call_media *media, struct stream_params } +__attribute__((nonnull(1, 2))) +static void media_gen_media_id(struct call_media *media, const sdp_ng_flags *flags) { + struct call_monologue *ml = media->monologue; + + if (!media->media_id.len && flags->generate_mid) + generate_mid(media, media->index); + if (media->media_id.len) + t_hash_table_insert(ml->media_ids, &media->media_id, media); +} + __attribute__((nonnull(1, 2, 3))) static void media_copy_media_id(struct call_media *media, struct call_media *other_media, const sdp_ng_flags *flags) { - struct call_monologue *ml = media->monologue; - // we already have a media ID. keep what we have and ignore what's // happening on the other side. if (media->media_id.len) @@ -2327,12 +2335,8 @@ static void media_copy_media_id(struct call_media *media, struct call_media *oth // outgoing side: we copy from the other side if (other_media->media_id.len) media->media_id = call_str_cpy(&other_media->media_id); - else if (flags->generate_mid) { - // or generate one - generate_mid(media, other_media->index); - } - if (media->media_id.len) - t_hash_table_insert(ml->media_ids, &media->media_id, media); + + media_gen_media_id(media, flags); } static void __t38_reset(struct call_media *media, struct call_media *other_media) {