mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 00:04:29 +08:00
transport: Unlink broadcast transport at release
This updates broadcast transport release to unlink stream from all its links.
This commit is contained in:
parent
3075a9c17d
commit
06c94f0ac0
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user