Re: [PATCH BlueZ bluez] shared/bap: Set stream to idle when I/O is disconnected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Jun 24, 2025 at 2:04 AM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@xxxxxxxxxx> wrote:
>
> From: Yang Li <yang.li@xxxxxxxxxxx>
>
> When the CIS link is disconnected, the ASE status transitions from Releasing to
> Idle.
>
>   > HCI Event: Disconnect Complete (0x05) plen 4           #1484 [hci0] 67.947425
>                 Status: Success (0x00)
>                 Handle: 512 Address: 5C:B1:E1:2F:01:B9 (Resolvable)
>                 Identity type: Random (0x01)
>                 Identity: E8:D5:2B:59:57:A6 (Static)
>                 Reason: Remote User Terminated Connection (0x13)
>   = bluetoothd: src/shared/bap.c:stream_io_disconnected() stream 0x..   67.948018
>   = bluetoothd: src/shared/bap.c:bap_ucast_set_state() stream 0xdff..   67.948145
>   = bluetoothd: src/shared/bap.c:stream_notify() stream 0xdffda8 st..   67.948275
>   = bluetoothd: src/gatt-database.c:send_notification_to_device() G..   67.948525
>   = bluetoothd: profiles/audio/bap.c:bap_state() stream 0xdffda8: r..   67.948679
>   = bluetoothd: profiles/audio/transport.c:bap_state_changed() stre..   67.948967
>   = bluetoothd: profiles/audio/transport.c:transport_update_playing..   67.949061
>   = bluetoothd: profiles/audio/transport.c:media_transport_remove_o..   67.949106
>   = bluetoothd: profiles/audio/transport.c:media_owner_free() Owner..   67.949149
>   = bluetoothd: profiles/audio/transport.c:media_transport_suspend(..   67.949375
>   = bluetoothd: profiles/audio/transport.c:transport_set_state() St..   67.949423
>   = bluetoothd: src/shared/bap.c:bap_ucast_detach() stream 0xdffda8..   67.949574
>   = bluetoothd: profiles/audio/media.c:pac_clear() endpoint 0xdd2d2..   67.949710
>
> When BIG sync is lost, the stream status transitions from Streaming to Idle.
>
>   > HCI Event: LE Meta Event (0x3e) plen 3                #3189 [hci0] 118.870863
>         LE Broadcast Isochronous Group Sync Lost (0x1e)
>                 BIG Handle: 0x00
>                 Reason: Remote User Terminated Connection (0x13)
>   = bluetoothd: src/shared/bap.c:stream_io_disconnected() stream 0..   118.871183
>   = bluetoothd: src/shared/bap.c:bap_bcast_set_state() stream 0xdf..   118.871227
>   = bluetoothd: profiles/audio/bap.c:bap_state_bcast_sink() stream..   118.871258
>   = bluetoothd: profiles/audio/bass.c:bap_state_changed() stream 0..   118.871307
>   = bluetoothd: src/gatt-database.c:send_notification_to_device()...   118.871384
>   = bluetoothd: profiles/audio/transport.c:bap_state_changed() str..   118.871452
>   = bluetoothd: profiles/audio/transport.c:transport_bap_update_li..   118.871509
>   = bluetoothd: profiles/audio/transport.c:transport_update_playin..   118.871555
>   = bluetoothd: profiles/audio/transport.c:transport_set_state() S..   118.871610
>   = bluetoothd: src/shared/bap.c:bap_bcast_sink_detach() stream 0x..   118.871660
>   = bluetoothd: profiles/audio/media.c:pac_clear() endpoint 0xdd25..   118.871689
>
> Fixes: https://github.com/bluez/bluez/issues/1343
>
> Signed-off-by: Yang Li <yang.li@xxxxxxxxxxx>
> ---
>  src/shared/bap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index bccbc73ff..d51f3106e 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -6584,10 +6584,8 @@ static bool stream_io_disconnected(struct io *io, void *user_data)
>
>         DBG(stream->bap, "stream %p io disconnected", stream);
>
> -       if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING)
> -               stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);

This is actually on purpose for unicast since that supports caching
the configuration, now perhaps this is not the case for broadcast
since the BIG may have been terminated so we probably need to check if
this is a broadcast stream or a unicast stream, or add a dedicated
callback for each type.

> +       stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE);
>
> -       bt_bap_stream_set_io(stream, -1);
>         return false;
>  }
>
>
> ---
> base-commit: ae1b7f6ba805f82742bbc32ff275e268248ef9f8
> change-id: 20250624-bap_for_big_sync_lost-63476c679dbb
>
> Best regards,
> --
> Yang Li <yang.li@xxxxxxxxxxx>
>
>
>


-- 
Luiz Augusto von Dentz





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux