Browse Source

MT#55283 use typed GHashTable for labels

Change-Id: Id5f514045d5b5c68394f7ab39430b700570ff3b4
pull/1776/head
Richard Fuchs 2 years ago
parent
commit
610238d5e3
3 changed files with 10 additions and 7 deletions
  1. +3
    -3
      daemon/call.c
  2. +3
    -3
      daemon/call_interfaces.c
  3. +4
    -1
      include/call.h

+ 3
- 3
daemon/call.c View File

@ -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();


+ 3
- 3
daemon/call_interfaces.c View File

@ -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)",


+ 4
- 1
include/call.h View File

@ -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;


Loading…
Cancel
Save