Browse Source

TT#45472 keep track of media IDs in a hash table

Change-Id: I66d2a5aff29447a60f4f3961165bfb6c0392a38e
changes/63/25363/2
Richard Fuchs 7 years ago
parent
commit
e1fbe25b89
2 changed files with 14 additions and 1 deletions
  1. +13
    -1
      daemon/call.c
  2. +1
    -0
      include/call.h

+ 13
- 1
daemon/call.c View File

@ -1672,13 +1672,21 @@ static void __endpoint_loop_protect(struct stream_params *sp, struct call_media
static void __update_media_id(struct call_media *media, struct call_media *other_media, static void __update_media_id(struct call_media *media, struct call_media *other_media,
struct stream_params *sp, const struct sdp_ng_flags *flags) struct stream_params *sp, const struct sdp_ng_flags *flags)
{ {
if (!flags)
return;
struct call *call = media->call; struct call *call = media->call;
struct call_monologue *ml = media->monologue;
struct call_monologue *other_ml = other_media->monologue;
if (flags && flags->opmode == OP_OFFER) {
if (flags->opmode == OP_OFFER) {
if (!other_media->media_id.s) { if (!other_media->media_id.s) {
// incoming side: we copy what we received // incoming side: we copy what we received
if (sp->media_id.s) if (sp->media_id.s)
call_str_cpy(call, &other_media->media_id, &sp->media_id); call_str_cpy(call, &other_media->media_id, &sp->media_id);
if (other_media->media_id.s)
g_hash_table_insert(other_ml->media_ids, &other_media->media_id,
other_media);
} }
if (!media->media_id.s) { if (!media->media_id.s) {
// outgoing side: we copy from the other side // outgoing side: we copy from the other side
@ -1690,6 +1698,8 @@ static void __update_media_id(struct call_media *media, struct call_media *other
snprintf(buf, sizeof(buf), "%u", other_media->index); snprintf(buf, sizeof(buf), "%u", other_media->index);
call_str_cpy_c(call, &media->media_id, buf); call_str_cpy_c(call, &media->media_id, buf);
} }
if (media->media_id.s)
g_hash_table_insert(ml->media_ids, &media->media_id, media);
} }
} }
} }
@ -2188,6 +2198,7 @@ static void __call_free(void *p) {
g_queue_clear(&m->medias); g_queue_clear(&m->medias);
g_hash_table_destroy(m->other_tags); g_hash_table_destroy(m->other_tags);
g_hash_table_destroy(m->media_ids);
g_slice_free1(sizeof(*m), m); g_slice_free1(sizeof(*m), m);
} }
@ -2331,6 +2342,7 @@ struct call_monologue *__monologue_create(struct call *call) {
ret->call = call; ret->call = call;
ret->created = rtpe_now.tv_sec; ret->created = rtpe_now.tv_sec;
ret->other_tags = g_hash_table_new(str_hash, str_equal); ret->other_tags = g_hash_table_new(str_hash, str_equal);
ret->media_ids = g_hash_table_new(str_hash, str_equal);
g_queue_init(&ret->medias); g_queue_init(&ret->medias);
gettimeofday(&ret->started, NULL); gettimeofday(&ret->started, NULL);


+ 1
- 0
include/call.h View File

@ -366,6 +366,7 @@ struct call_monologue {
GHashTable *other_tags; GHashTable *other_tags;
struct call_monologue *active_dialogue; struct call_monologue *active_dialogue;
GQueue medias; GQueue medias;
GHashTable *media_ids;
int block_dtmf:1; int block_dtmf:1;
int block_media:1; int block_media:1;


Loading…
Cancel
Save