From 84c8f156ea2b2ac010ffe11d2fffdb78ebab5e26 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Fri, 10 Nov 2023 17:39:05 +0100 Subject: [PATCH] MT#57550 Update `call_get_monologue_new()` to use media subs During the `monologues_intact` stage of the `call_get_monologue_new()` use media subscription in order to: - update `os` ml, if still not set before - update subscription ml's tag with totag, if not set before After the first possible subscription's `offer/answer` ml has been found and all work done, break cycling expecting that this is one-to-one (so offer/answer) model, where only medias of two monologues are involved. Change-Id: I8b06cee2090563da4ce4c290ab3c0b9ce8c7ab3f --- daemon/call.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index b81b3e39a..d513f5c44 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -4704,18 +4704,27 @@ new_branch: __subscribe_matched_medias(ret, os); monologues_intact: - for (GList *sub = ret->subscriptions.head; sub; sub = sub->next) { - struct call_subscription *cs = sub->data; - if (!cs->attrs.offer_answer) + for (unsigned int i = 0; i < ret->medias->len; i++) + { + struct call_media *media = ret->medias->pdata[i]; + if (!media) continue; - struct call_monologue *csm = cs->monologue; - if (!os) - os = csm; - if (totag && totag->s && !csm->tag.s) - __monologue_tag(csm, totag); - break; // there should only be one - // XXX check if there's more than a one-to-one mapping here? + for (GList *l = media->media_subscriptions.head; l; l = l->next) + { + struct media_subscription * ms = l->data; + if (!ms->attrs.offer_answer) + continue; + if (!os) + os = ms->monologue; + if (totag && totag->s && !ms->monologue->tag.s) + __monologue_tag(ms->monologue, totag); + /* There should be only one monologue? + * TODO: check if there's more than one-to-one mapping */ + goto monologues_intact_finalize; + } } + +monologues_intact_finalize: if (G_UNLIKELY(!os)) return -1; __tags_associate(ret, os);