Re: [PATCH BlueZ bluez v3] bap: fixed issue of muting music silent after pause and resume.

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

 



Hi Yang,

On Wed, Feb 12, 2025 at 9:58 PM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@xxxxxxxxxx> wrote:
>
> From: Yang Li <yang.li@xxxxxxxxxxx>
>
> After the ASE state changes (streaming->releasing->idle),
> the Client needs to be notified. The process as follows:
>
> ...(Sink ASE: ID=1, State=Streaming)
> ATT Write Command Packet (ASE Control Point: Op=Release)
> ATT Notification Packet (Sink ASE: ID=1, State=Releasing)
> ATT Notification Packet (Sink ASE: ID=1, State=Idle)
>
> Signed-off-by: Yang Li <yang.li@xxxxxxxxxxx>
> ---
> Changes in v3:
> - Solve the compilation error reported by test.bot
> - Link to v2: https://patch.msgid.link/20250208-ascs_bug-v2-1-b7e062d6604d@xxxxxxxxxxx
> ---
>  src/shared/bap.c | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index 167501282..079f7ede0 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -930,6 +930,18 @@ static void ascs_ase_rsp_success(struct iovec *iov, uint8_t id)
>                                         BT_ASCS_REASON_NONE);
>  }
>
> +static void stream_notify_ase_state(struct bt_bap_stream *stream)
> +{
> +       struct bt_bap_endpoint *ep = stream->ep;
> +       struct bt_ascs_ase_status status;
> +
> +       status.id = ep->id;
> +       status.state = ep->state;
> +
> +       gatt_db_attribute_notify(ep->attr, (void *)&status, sizeof(status),
> +                                       bt_bap_get_att(stream->bap));
> +}
> +
>  static void stream_notify_config(struct bt_bap_stream *stream)
>  {
>         struct bt_bap_endpoint *ep = stream->ep;
> @@ -1634,7 +1646,9 @@ static bool stream_notify_state(void *data)
>         struct bt_bap_stream *stream = data;
>         struct bt_bap_endpoint *ep = stream->ep;
>
> -       DBG(stream->bap, "stream %p", stream);
> +       DBG(stream->bap, "stream %p state %s",
> +                       stream,
> +                       bt_bap_stream_statestr(ep->state));
>
>         if (stream->state_id) {
>                 timeout_remove(stream->state_id);
> @@ -1643,6 +1657,7 @@ static bool stream_notify_state(void *data)
>
>         switch (ep->state) {
>         case BT_ASCS_ASE_STATE_IDLE:
> +               stream_notify_ase_state(stream);
>                 break;
>         case BT_ASCS_ASE_STATE_CONFIG:
>                 stream_notify_config(stream);
> @@ -1655,6 +1670,9 @@ static bool stream_notify_state(void *data)
>         case BT_ASCS_ASE_STATE_DISABLING:
>                 stream_notify_metadata(stream);
>                 break;
> +       case BT_ASCS_ASE_STATE_RELEASING:
> +               stream_notify_ase_state(stream);
> +               break;
>         }
>
>         return false;
> @@ -2068,17 +2086,11 @@ static unsigned int bap_ucast_metadata(struct bt_bap_stream *stream,
>
>  static uint8_t stream_release(struct bt_bap_stream *stream, struct iovec *rsp)
>  {
> -       struct bt_bap_pac *pac;
> -
>         DBG(stream->bap, "stream %p", stream);
>
>         ascs_ase_rsp_success(rsp, stream->ep->id);
>
> -       pac = stream->lpac;
> -       if (pac->ops && pac->ops->clear)
> -               pac->ops->clear(stream, pac->user_data);

This part I don't really understand, why are you removing the call to
clear? Or are you relying on bap_stream_clear_cfm? That is only called
on detach/disconnect so I don't think we should be removing the code
above since it is still possible to reconfigure after releasing.

> -       stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE);
> +       stream_set_state(stream, BT_BAP_STREAM_STATE_RELEASING);
>
>         return 0;
>  }
> @@ -6172,7 +6184,8 @@ static bool stream_io_disconnected(struct io *io, void *user_data)
>
>         DBG(stream->bap, "stream %p io disconnected", stream);
>
> -       bt_bap_stream_set_io(stream, -1);
> +       if (stream->ep->state == BT_BAP_STREAM_STATE_RELEASING)
> +               stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE);
>
>         return false;
>  }
>
> ---
> base-commit: 2ee08ffd4d469781dc627fa50b4a015d9ad68007
> change-id: 20250208-ascs_bug-e7c5715d3d8c
>
> 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