Skip to content

Commit

Permalink
MT#56465 Introduce call_get_top_media_subscription() func
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zenichev committed May 23, 2024
1 parent 322fb3d commit 4dfd949
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions daemon/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -3270,6 +3270,24 @@ struct media_subscription *call_get_media_subscription(subscription_ht ht, struc
return l->data;
}

/**
* Retrieve top most media subscription of top media for a given call monologue.
* It's useful for offer/answer model cases,
* where most of cases single-to-single subscription model is used.
*/
struct media_subscription *call_get_top_media_subscription(struct call_monologue *ml) {
for (int i = 0; i < ml->medias->len; i++)
{
struct call_media * media = ml->medias->pdata[i];
if (!media)
continue;
__auto_type subcription = media->media_subscriptions.head;
if (subcription)
return subcription->data;
}
return NULL;
}

/* called with call->master_lock held in W */
__attribute__((nonnull(1, 2, 3)))
int monologue_publish(struct call_monologue *ml, sdp_streams_q *streams, sdp_ng_flags *flags) {
Expand Down
1 change: 1 addition & 0 deletions include/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ void __monologue_viabranch(struct call_monologue *ml, const str *viabranch);
struct packet_stream *__packet_stream_new(call_t *call);
void __add_media_subscription(struct call_media * which, struct call_media * to,
const struct sink_attrs *attrs);
struct media_subscription *call_get_top_media_subscription(struct call_monologue *ml);
struct media_subscription *call_get_media_subscription(subscription_ht ht, struct call_media * cm);
struct call_monologue * ml_medias_subscribed_to_single_ml(struct call_monologue *ml);

Expand Down

0 comments on commit 4dfd949

Please sign in to comment.