diff --git a/daemon/call.c b/daemon/call.c index 5db7182e3..c38967623 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3449,6 +3449,23 @@ struct media_subscription *call_ml_get_top_ms(struct call_monologue *ml) { return NULL; } +/** + * Checks if any present audio medias put this monologue into sendonly state. + * Should only be used when medias are already initialized with flags. + */ +bool call_ml_sendonly(struct call_monologue *ml) { + for (int i = 0; i < ml->medias->len; i++) + { + struct call_media * media = ml->medias->pdata[i]; + if (!media || media->type_id != MT_AUDIO) + continue; + /* sendonly media means it can receive packets, but doesn't send */ + if (!MEDIA_ISSET(media, SEND) && MEDIA_ISSET(media, RECV)) + return true; + } + return false; +} + /* 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) { diff --git a/include/call.h b/include/call.h index 0f0e04876..9831830cf 100644 --- a/include/call.h +++ b/include/call.h @@ -810,6 +810,7 @@ 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_ml_get_top_ms(struct call_monologue *ml); +bool call_ml_sendonly(struct call_monologue *ml); struct media_subscription *call_media_get_top_ms(struct call_media * cm); 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);