Re: [PATCH BlueZ v2 1/1] bap: Use defer setup when syncing to a BIS source

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

 



> This commit uses the newly added bt_io_bcast_accept function from
> btio.c to implement the defer setup for the BIS sync process.
> Now, information from the BIG Info advertising report can be
> used when sending the BIG Create Sync command.
> ---
>  profiles/audio/bap.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> index ee90426b9..8a2da24dd 100644
> --- a/profiles/audio/bap.c
> +++ b/profiles/audio/bap.c
> @@ -840,6 +840,22 @@ drop:
>  
>  }
>  
> +static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
> +{
> +	GError *err = NULL;
> +
> +	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
> +				user_data, NULL, &err)) {
> +		error("bt_io_bcast_accept: %s", err->message);
> +		g_error_free(err);
> +		goto drop;
> +	}
> +	return;
> +
> +drop:
> +	g_io_channel_shutdown(io, TRUE, NULL);
> +}
Maybe we do not need goto. It's can be more concise as following:

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
{
	GError *err = NULL;

	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
				user_data, NULL, &err)) {
		error("bt_io_bcast_accept: %s", err->message);
		g_error_free(err);
		g_io_channel_shutdown(io, TRUE, NULL);
	}
}

or

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
{
	GError *err = NULL;

	if (bt_io_bcast_accept(io, iso_bcast_confirm_cb,
				user_data, NULL, &err)) {
		return;
	}

	error("bt_io_bcast_accept: %s", err->message);
	g_error_free(err);
	g_io_channel_shutdown(io, TRUE, NULL);
}


William Xuan
> +
>  static bool match_data_bap_data(const void *data, const void *match_data)
>  {
>  	const struct bap_data *bdata = data;
> @@ -1587,7 +1603,7 @@ static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep,
>  	if (bt_bap_stream_get_io(stream) || data->listen_io)
>  		return;
>  
> -	io = bt_io_listen(iso_bcast_confirm_cb, NULL, ep->data, NULL, &err,
> +	io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, ep->data, NULL, &err,
>  			BT_IO_OPT_SOURCE_BDADDR,
>  			btd_adapter_get_address(ep->data->adapter),
>  			BT_IO_OPT_DEST_BDADDR,
> 



[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