Browse Source

MT#55283 simpler ml_medias_subscribed_to_single_ml

We only need to check for uniqueness and we can do that without managing
a queue.

Change-Id: Iada872b780bf34bdf08e5129829603686dd2dc2a
pull/1786/head
Richard Fuchs 2 years ago
parent
commit
aa7d7a01ab
1 changed files with 4 additions and 10 deletions
  1. +4
    -10
      daemon/call.c

+ 4
- 10
daemon/call.c View File

@ -3044,7 +3044,6 @@ static void __unsubscribe_medias_from_all(struct call_monologue *ml) {
*/ */
static struct call_monologue * ml_medias_subscribed_to_single_ml(struct call_monologue *ml) { static struct call_monologue * ml_medias_subscribed_to_single_ml(struct call_monologue *ml) {
/* detect monologues multiplicity */ /* detect monologues multiplicity */
g_auto(GQueue) mls = G_QUEUE_INIT;
struct call_monologue * return_ml = NULL; struct call_monologue * return_ml = NULL;
for (unsigned int i = 0; i < ml->medias->len; i++) for (unsigned int i = 0; i < ml->medias->len; i++)
{ {
@ -3054,15 +3053,10 @@ static struct call_monologue * ml_medias_subscribed_to_single_ml(struct call_mon
for (__auto_type l = media->media_subscriptions.head; l; l = l->next) for (__auto_type l = media->media_subscriptions.head; l; l = l->next)
{ {
struct media_subscription * ms = l->data; struct media_subscription * ms = l->data;
return_ml = ms->monologue;
g_queue_push_tail(&mls, ms->monologue);
/* check if the following mononoluge is different one */
if (l->next) {
ms = l->next->data;
if (!g_queue_find(&mls, ms->monologue)) {
return NULL; /* subscription to medias of different monologues */
}
}
if (!return_ml)
return_ml = ms->monologue;
else if (ms->monologue != return_ml)
return NULL;
} }
} }
return return_ml; return return_ml;


Loading…
Cancel
Save