From d5c1fa418e1b82c1f3e47e5954d4614c79ce6734 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 8 Aug 2025 10:54:56 -0400 Subject: [PATCH] MT#63317 keep rtpext names in table Change-Id: I9a2904ff22dc6235c2bfa8f4af5bd72f49ba37fe --- daemon/call.c | 4 ++++ include/call.h | 1 + include/media_socket.h | 1 + 3 files changed, 6 insertions(+) diff --git a/daemon/call.c b/daemon/call.c index 834e2a7c6..597100a2f 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -682,6 +682,7 @@ struct call_media *call_media_new(call_t *call) { ssrc_hash_call_init(&med->ssrc_hash_in); ssrc_hash_call_init(&med->ssrc_hash_out); med->extmap_ht = extmap_ht_new(); + med->ext_name_ht = ext_name_ht_new(); med->extmap_lookup = call_media_ext_lookup_array; return med; } @@ -2864,6 +2865,7 @@ __attribute__((nonnull(1, 2))) static void media_init_extmap(struct call_media *media, struct rtp_extension *ext) { ext->name = call_str_cpy(&ext->name); + t_hash_table_insert(media->ext_name_ht, &ext->name, ext); t_hash_table_insert(media->extmap_ht, GUINT_TO_POINTER(ext->id), ext); if (ext->id > 0 && ext->id <= 14) @@ -2879,6 +2881,7 @@ static void media_update_extmap(struct call_media *media, struct stream_params * media->extmap = sp->extmap; t_queue_init(&sp->extmap); + t_hash_table_remove_all(media->ext_name_ht); t_hash_table_remove_all(media->extmap_ht); memset(media->extmap_a, 0, sizeof(media->extmap_a)); media->extmap_lookup = call_media_ext_lookup_array; @@ -4421,6 +4424,7 @@ void call_media_free(struct call_media **mdp) { ssrc_hash_destroy(&md->ssrc_hash_in); ssrc_hash_destroy(&md->ssrc_hash_out); t_hash_table_destroy(md->extmap_ht); + t_hash_table_destroy(md->ext_name_ht); t_queue_clear_full(&md->extmap, rtp_extension_free); g_free(md); *mdp = NULL; diff --git a/include/call.h b/include/call.h index eb5b4b74e..67bb0a129 100644 --- a/include/call.h +++ b/include/call.h @@ -489,6 +489,7 @@ struct call_media { struct rtp_extension *extmap_a[14]; // 1-14 -> [0..13] extmap_ht extmap_ht; struct rtp_extension *(*extmap_lookup)(struct call_media *, unsigned int); + ext_name_ht ext_name_ht; str media_id; str label; diff --git a/include/media_socket.h b/include/media_socket.h index 8a2d20de1..7242597e9 100644 --- a/include/media_socket.h +++ b/include/media_socket.h @@ -298,6 +298,7 @@ static inline void rtp_extension_free(struct rtp_extension *r) { TYPED_GQUEUE(extmap, struct rtp_extension); TYPED_GHASHTABLE(extmap_ht, void, struct rtp_extension, g_direct_hash, g_direct_equal, NULL, NULL); +TYPED_GHASHTABLE(ext_name_ht, str, struct rtp_extension, str_hash, str_equal, NULL, NULL); extern local_intf_q all_local_interfaces; // read-only during runtime