From 13367cb2e6a29f2932b188310531f0c7fdd33060 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Wed, 13 Sep 2023 15:27:47 +0200 Subject: [PATCH] MT#57719 stop using call subscriptions for `__sub_is_transcoding()` Stop using call subscriptions for lookups based on the `__sub_is_transcoding()` and use media subscriptions instead. Change-Id: I545daca19f5ce433fd660a5a7d60181ac4ed1d8b --- daemon/call.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 6c7b76bc8..eb629c1f5 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2762,15 +2762,25 @@ unsigned int proto_num_ports(unsigned int sp_ports, struct call_media *media, st static int __sub_is_transcoding(gconstpointer p, gconstpointer dummy) { - const struct call_subscription *cs = p; - return cs->attrs.transcoding ? 0 : 1; + const struct media_subscription *ms = p; + return ms->attrs.transcoding ? 0 : 1; } // set transcoding flag if any media flows are transcoding, otherwise unset it static void set_monologue_flags_per_subscribers(struct call_monologue *ml) { ml->transcoding = 0; - if (g_queue_find_custom(&ml->subscribers, NULL, __sub_is_transcoding)) - ml->transcoding = 1; + /* find at least one media susbcriber who requires a transcoding */ + for (int i = 0; i < ml->medias->len; i++) + { + struct call_media * media = ml->medias->pdata[i]; + if (!media) + continue; + + if (g_queue_find_custom(&media->media_subscribers, NULL, __sub_is_transcoding)) { + ml->transcoding = 1; + return; + } + } } /* called with call->master_lock held in W */