This updates broadcast transport release to unlink stream from all its links. --- profiles/audio/transport.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index bb2ce8a4a..5646b2004 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -1779,10 +1779,45 @@ static guint transport_bap_resume(struct media_transport *transport, return id; } +static void update_links(void *data, void *user_data) +{ + struct bt_bap_stream *link = data; + struct media_transport *transport; + + transport = find_transport_by_bap_stream(link); + if (!transport) { + error("Unable to find transport"); + return; + } + + bap_update_links(transport); +} + +static void transport_unlink(void *data, void *user_data) +{ + struct bt_bap_stream *link = data; + struct bt_bap_stream *stream = user_data; + struct media_transport *transport; + + transport = find_transport_by_bap_stream(link); + if (!transport) { + error("Unable to find transport"); + return; + } + + bt_bap_stream_io_unlink(link, stream); + + bap_update_links(transport); + + /* Emit property changed for all remaining links */ + queue_foreach(bt_bap_stream_io_get_links(link), update_links, NULL); +} + static guint transport_bap_suspend(struct media_transport *transport, struct media_owner *owner) { struct bap_transport *bap = transport->data; + struct queue *links = bt_bap_stream_io_get_links(bap->stream); bt_bap_stream_func_t func = NULL; guint id; @@ -1794,6 +1829,10 @@ static guint transport_bap_suspend(struct media_transport *transport, else transport_set_state(transport, TRANSPORT_STATE_IDLE); + if (bt_bap_stream_get_type(bap->stream) == BT_BAP_STREAM_TYPE_BCAST) + /* Unlink stream from all its links */ + queue_foreach(links, transport_unlink, bap->stream); + bap_update_links(transport); id = bt_bap_stream_disable(bap->stream, bap->linked, func, owner); -- 2.43.0