Skip to content

Commit 4dfd949

Browse files
committed
MT#56465 Introduce call_get_top_media_subscription() func
In order to be able to retrieve the top most media subscription of top media for a given call monologue, introduce a new func: `call_get_top_media_subscription()` This is then useful for offer/answer model cases, where most of cases single-to-single subscription model is used, and one needs just an access to the opposite subscription/monologue/etc. Change-Id: I6139a0987eda618d0d27b173abdce6c7562e0544
1 parent 322fb3d commit 4dfd949

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

daemon/call.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,6 +3270,24 @@ struct media_subscription *call_get_media_subscription(subscription_ht ht, struc
32703270
return l->data;
32713271
}
32723272

3273+
/**
3274+
* Retrieve top most media subscription of top media for a given call monologue.
3275+
* It's useful for offer/answer model cases,
3276+
* where most of cases single-to-single subscription model is used.
3277+
*/
3278+
struct media_subscription *call_get_top_media_subscription(struct call_monologue *ml) {
3279+
for (int i = 0; i < ml->medias->len; i++)
3280+
{
3281+
struct call_media * media = ml->medias->pdata[i];
3282+
if (!media)
3283+
continue;
3284+
__auto_type subcription = media->media_subscriptions.head;
3285+
if (subcription)
3286+
return subcription->data;
3287+
}
3288+
return NULL;
3289+
}
3290+
32733291
/* called with call->master_lock held in W */
32743292
__attribute__((nonnull(1, 2, 3)))
32753293
int monologue_publish(struct call_monologue *ml, sdp_streams_q *streams, sdp_ng_flags *flags) {

include/call.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ void __monologue_viabranch(struct call_monologue *ml, const str *viabranch);
803803
struct packet_stream *__packet_stream_new(call_t *call);
804804
void __add_media_subscription(struct call_media * which, struct call_media * to,
805805
const struct sink_attrs *attrs);
806+
struct media_subscription *call_get_top_media_subscription(struct call_monologue *ml);
806807
struct media_subscription *call_get_media_subscription(subscription_ht ht, struct call_media * cm);
807808
struct call_monologue * ml_medias_subscribed_to_single_ml(struct call_monologue *ml);
808809

0 commit comments

Comments
 (0)