diff --git a/daemon/call.c b/daemon/call.c index 94be70fd8..918ff3303 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -682,7 +682,7 @@ static struct call_media *__get_media(struct call_monologue *ml, const struct st if (sp->media_id.len) { // in this case, the media sections can be out of order and the media ID // string is used to determine which media section to operate on. - med = g_hash_table_lookup(ml->media_ids, &sp->media_id); + med = t_hash_table_lookup(ml->media_ids, &sp->media_id); if (med) { if (med->type_id == sp->type_id) return med; @@ -2253,7 +2253,7 @@ static void __update_media_id(struct call_media *media, struct call_media *other if (sp->media_id.s) other_media->media_id = call_str_cpy(&sp->media_id); if (other_media->media_id.s) - g_hash_table_insert(other_ml->media_ids, &other_media->media_id, + t_hash_table_insert(other_ml->media_ids, &other_media->media_id, other_media); } else { @@ -2262,9 +2262,9 @@ static void __update_media_id(struct call_media *media, struct call_media *other if (sp->media_id.s) { if (str_cmp_str(&other_media->media_id, &sp->media_id)) { // mismatch - update - g_hash_table_remove(other_ml->media_ids, &other_media->media_id); + t_hash_table_remove(other_ml->media_ids, &other_media->media_id); other_media->media_id = call_str_cpy(&sp->media_id); - g_hash_table_insert(other_ml->media_ids, &other_media->media_id, + t_hash_table_insert(other_ml->media_ids, &other_media->media_id, other_media); } } @@ -2285,7 +2285,7 @@ static void __update_media_id(struct call_media *media, struct call_media *other media->media_id = call_str_cpy_c(buf); } if (media->media_id.s) - g_hash_table_insert(ml->media_ids, &media->media_id, media); + t_hash_table_insert(ml->media_ids, &media->media_id, media); } else { // we already have a media ID. keep what we have and ignore what's @@ -4113,7 +4113,7 @@ void call_media_free(struct call_media **mdp) { void __monologue_free(struct call_monologue *m) { t_ptr_array_free(m->medias, true); g_hash_table_destroy(m->associated_tags); - g_hash_table_destroy(m->media_ids); + t_hash_table_destroy(m->media_ids); free_ssrc_hash(&m->ssrc_hash); if (m->last_out_sdp) g_string_free(m->last_out_sdp, TRUE); @@ -4335,7 +4335,7 @@ struct call_monologue *__monologue_create(call_t *call) { ret->created = rtpe_now.tv_sec; ret->associated_tags = g_hash_table_new(g_direct_hash, g_direct_equal); ret->medias = medias_arr_new(); - ret->media_ids = g_hash_table_new((GHashFunc) str_hash, (GEqualFunc) str_equal); + ret->media_ids = media_id_ht_new(); ret->ssrc_hash = create_ssrc_hash_call(); ret->sdp_attr_print = sdp_insert_monologue_attributes; /* explicitely set b=RR/b=RS to -1 so it's not considered as 0 inadvertently */ diff --git a/daemon/ice.c b/daemon/ice.c index a546318a1..3a7feb8af 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -95,7 +95,7 @@ static void ice_update_media_streams(struct call_monologue *ml, sdp_streams_q *s struct call_media *media = NULL; if (sp->media_id.len) - media = g_hash_table_lookup(ml->media_ids, &sp->media_id); + media = t_hash_table_lookup(ml->media_ids, &sp->media_id); else if (sp->index > 0) { unsigned int arr_idx = sp->index - 1; if (arr_idx < ml->medias->len) diff --git a/daemon/redis.c b/daemon/redis.c index dcebbef41..ddd13da9b 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1916,7 +1916,7 @@ static int json_link_medias(call_t *c, struct redis_list *medias, return -1; if (med->media_id.s) - g_hash_table_insert(med->monologue->media_ids, &med->media_id, med); + t_hash_table_insert(med->monologue->media_ids, &med->media_id, med); /* find the pair media to subscribe */ if (!json_build_list_cb(NULL, c, "media-subscriptions", med->unique_id, diff --git a/include/call.h b/include/call.h index 1ebc4b10c..0653620fd 100644 --- a/include/call.h +++ b/include/call.h @@ -328,6 +328,7 @@ TYPED_GQUEUE(subscription, struct media_subscription) TYPED_DIRECT_FUNCS(media_direct_hash, media_direct_eq, struct call_media) TYPED_GHASHTABLE(subscription_ht, struct call_media, subscription_list, media_direct_hash, media_direct_eq, NULL, NULL) +TYPED_GHASHTABLE(media_id_ht, str, struct call_media, str_hash, str_equal, NULL, NULL) struct session_bandwidth { long as, rr, rs, ct, tias; @@ -587,7 +588,7 @@ struct call_monologue { GHashTable *associated_tags; GHashTable *subscribers_ht; /* for quick lookup */ medias_arr *medias; - GHashTable *media_ids; + media_id_ht media_ids; struct media_player *player; struct media_player *rec_player; struct session_bandwidth sdp_session_bandwidth;