From aa7d7a01ab3e3b2103eb2a9b9b0beac12ac2bb30 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 17 Jan 2024 10:34:05 -0500 Subject: [PATCH] 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 --- daemon/call.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 2df0fd510..d133c25b2 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -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) { /* detect monologues multiplicity */ - g_auto(GQueue) mls = G_QUEUE_INIT; struct call_monologue * return_ml = NULL; 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) { 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;