diff --git a/daemon/call.c b/daemon/call.c index c4b2fba57..ceed2b8ba 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2594,7 +2594,7 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, sdp_ng_f if (flags && flags->label.s) { call_str_cpy(call, &ml->label, &flags->label); - g_hash_table_replace(call->labels, &ml->label, ml); + t_hash_table_replace(call->labels, &ml->label, ml); } } @@ -3912,7 +3912,7 @@ static void __call_free(void *p) { g_hash_table_destroy(c->tags); g_hash_table_destroy(c->viabranches); - g_hash_table_destroy(c->labels); + t_hash_table_destroy(c->labels); while (c->streams.head) { ps = t_queue_pop_head(&c->streams); @@ -3943,7 +3943,7 @@ static struct call *call_create(const str *callid) { rwlock_init(&c->master_lock); c->tags = g_hash_table_new(str_hash, str_equal); c->viabranches = g_hash_table_new(str_hash, str_equal); - c->labels = g_hash_table_new(str_hash, str_equal); + c->labels = labels_ht_new(); call_str_cpy(c, &c->callid, callid); c->created = rtpe_now; c->dtls_cert = dtls_cert(); diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 036793740..d46bd966d 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -2673,7 +2673,7 @@ static const char *media_block_match1(struct call *call, struct call_monologue * sdp_ng_flags *flags) { if (flags->label.s) { - *monologue = g_hash_table_lookup(call->labels, &flags->label); + *monologue = t_hash_table_lookup(call->labels, &flags->label); if (!*monologue) return "No monologue matching the given label"; } @@ -2736,7 +2736,7 @@ static const char *media_block_match(struct call **call, struct call_monologue * // for generic ops, handle set-label here if given if (opmode == OP_OTHER && flags->set_label.len && *monologue) { call_str_cpy(*call, &(*monologue)->label, &flags->set_label); - g_hash_table_replace((*call)->labels, &(*monologue)->label, *monologue); + t_hash_table_replace((*call)->labels, &(*monologue)->label, *monologue); } return NULL; @@ -3047,7 +3047,7 @@ static const char *call_block_silence_media(bencode_item_t *input, bool on_off, g_queue_push_tail(&sinks, sink); } else if (flags.to_label.len) { - struct call_monologue *sink = g_hash_table_lookup(call->labels, &flags.to_label); + struct call_monologue *sink = t_hash_table_lookup(call->labels, &flags.to_label); if (!sink) { ilog(LOG_WARN, "Media flow '" STR_FORMAT_M "' -> label '" STR_FORMAT "' doesn't " "exist for media %s (to-label not found)", diff --git a/include/call.h b/include/call.h index 94e5a2ceb..54886e06d 100644 --- a/include/call.h +++ b/include/call.h @@ -619,6 +619,9 @@ struct call_iterator_entry { mutex_unlock(&rtpe_call_iterators[__which].lock); \ } while (0) + +TYPED_GHASHTABLE(labels_ht, str, struct call_monologue, str_hash, str_equal, NULL, NULL) + /** * struct call is the main parent structure of all call-related objects. * @@ -669,7 +672,7 @@ struct call { GQueue medias; /* call_media */ GHashTable *tags; GHashTable *viabranches; - GHashTable *labels; + labels_ht labels; packet_stream_q streams; stream_fd_q stream_fds; /* stream_fd */ GQueue endpoint_maps;