Re: [PATCH BlueZ bluez v3] shared/bap: Add stream state check in stream_disable

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

 



Hi,

On Tue, Jul 1, 2025 at 9:19 PM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@xxxxxxxxxx> wrote:
>
> From: Yang Li <yang.li@xxxxxxxxxxx>
>
> Add a state check so that stream_disable() is a no-op when the stream
> is not in ENABLING or STREAMING state. This prevents unexpected state
> transitions or redundant operations during cleanup.

What is the issue here, do you have traces, debug logs, etc?

> Signed-off-by: Yang Li <yang.li@xxxxxxxxxxx>
> ---
> Changes in v3:
> - Optimizing the code
> - Link to v2: https://patch.msgid.link/20250630-bap_for_big_sync_lost-v2-0-1491b608cda5@xxxxxxxxxxx
>
> bap for big sync lost
>
> To: Linux Bluetooth <linux-bluetooth@xxxxxxxxxxxxxxx>
> Signed-off-by: Yang Li <yang.li@xxxxxxxxxxx>
>
> Changes in v2:
> - Add state check in stream_disable.
> - Add type check in stream_io_disconnected.
> - Link to v1: https://patch.msgid.link/20250624-bap_for_big_sync_lost-v1-1-0df90a0f55d0@xxxxxxxxxxx
> ---
>  src/shared/bap.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index 40e1c974b..1790b277b 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -2131,14 +2131,20 @@ static uint8_t stream_disable(struct bt_bap_stream *stream, struct iovec *rsp)
>
>         ascs_ase_rsp_success(rsp, stream->ep->id);
>
> -       /* Sink can autonomously transit to QOS while source needs to go to
> -        * Disabling until BT_ASCS_STOP is received.
> -        */
> -       if (stream->ep->dir == BT_BAP_SINK)
> -               stream_set_state(stream, BT_BAP_STREAM_STATE_QOS);
> -
> -       if (stream->ep->dir == BT_BAP_SOURCE)
> -               stream_set_state(stream, BT_BAP_STREAM_STATE_DISABLING);
> +       switch (stream->ep->state) {
> +               case BT_ASCS_ASE_STATE_ENABLING:
> +               case BT_ASCS_ASE_STATE_STREAMING:
> +                       if (stream->ep->dir == BT_BAP_SINK)
> +                               stream_set_state(stream, BT_BAP_STREAM_STATE_QOS);
> +                       else if (stream->ep->dir == BT_BAP_SOURCE)
> +                               /* Sink can autonomously transit to QOS while source needs to go to
> +                               * Disabling until BT_ASCS_STOP is received.
> +                               */
> +                               stream_set_state(stream, BT_BAP_STREAM_STATE_DISABLING);
> +                       break;
> +               default:
> +                       break;
> +       }
>
>         return 0;
>  }
>
> ---
> base-commit: 55a6763cde8a2309fd23a96479ee4cf2fc23a442
> 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