RE: [PATCH BlueZ v3 2/6] shared/bap: Add support to set stream metadata

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

 



Hi Luiz,

I agree. Shall continue using "bt_bap_steam_metadata" API.

Thanks & Regards,
Abhay

-----Original Message-----
From: Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> 
Sent: 04 January 2023 05:55
To: Maheta, Abhay <abhay.maheshbhai.maheta@xxxxxxxxx>
Cc: linux-bluetooth@xxxxxxxxxxxxxxx; Abhay Maheta <mabhay125@xxxxxxxxx>
Subject: Re: [PATCH BlueZ v3 2/6] shared/bap: Add support to set stream metadata

Hi Abhay,

On Thu, Dec 29, 2022 at 7:57 AM Abhay Maheta <abhay.maheshbhai.maheta@xxxxxxxxx> wrote:
>
> This adds new API to set stream metadata.
> ---
>  src/shared/bap.c | 30 +++++++++++++++++++++++-------  
> src/shared/bap.h |  2 ++
>  2 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c index 
> 0cafb75e6..b3c65283e 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -344,8 +344,10 @@ static void pac_foreach(void *data, void 
> *user_data)
>
>         p = util_iov_push(iov, sizeof(*p));
>         p->codec.id = pac->codec.id;
> -       p->codec.cid = pac->codec.cid;
> -       p->codec.vid = pac->codec.vid;
> +       if (p->codec.id == 0xff) {
> +               p->codec.cid = cpu_to_le16(pac->codec.cid);
> +               p->codec.vid = cpu_to_le16(pac->codec.vid);
> +       }
>
>         if (pac->data) {
>                 p->cc_len = pac->data->iov_len; @@ -2773,7 +2775,7 @@ 
> static void bap_parse_pacs(struct bt_bap *bap, uint8_t type,
>                 struct bt_pac *p;
>                 struct bt_ltv *cc;
>                 struct bt_pac_metadata *meta;
> -               struct iovec data, metadata;
> +               struct iovec data, *metadata = NULL;
>
>                 p = util_iov_pull_mem(&iov, sizeof(*p));
>                 if (!p) {
> @@ -2802,8 +2804,11 @@ static void bap_parse_pacs(struct bt_bap *bap, uint8_t type,
>                 data.iov_len = p->cc_len;
>                 data.iov_base = cc;
>
> -               metadata.iov_len = meta->len;
> -               metadata.iov_base = meta->data;
> +               if (meta->len) {
> +                       metadata = new0(struct iovec, 1);
> +                       metadata->iov_len = meta->len;
> +                       metadata->iov_base = meta->data;
> +               }
>
>                 util_iov_pull_mem(&iov, meta->len);
>
> @@ -2813,12 +2818,14 @@ static void bap_parse_pacs(struct bt_bap *bap, uint8_t type,
>                 /* Check if there is already a PAC record for the codec */
>                 pac = bap_pac_find(bap->rdb, type, &p->codec);
>                 if (pac) {
> -                       bap_pac_merge(pac, &data, &metadata);
> +                       bap_pac_merge(pac, &data, metadata);
> +                       free(metadata);
>                         continue;
>                 }
>
>                 pac = bap_pac_new(bap->rdb, NULL, type, &p->codec, NULL, &data,
> -                                                               &metadata);
> +                                                               metadata);
> +               free(metadata);
>                 if (!pac)
>                         continue;
>
> @@ -4591,6 +4598,15 @@ struct bt_bap_qos *bt_bap_stream_get_qos(struct bt_bap_stream *stream)
>         return &stream->qos;
>  }
>
> +void bt_bap_stream_set_metadata(struct bt_bap_stream *stream,
> +                               struct iovec *meta) {
> +       if (!stream)
> +               return;
> +
> +       stream_metadata(stream, meta, NULL); }
> +
>  struct iovec *bt_bap_stream_get_metadata(struct bt_bap_stream 
> *stream)  {
>         if (!stream)
> diff --git a/src/shared/bap.h b/src/shared/bap.h index 
> 47a15636c..bcf830ceb 100644
> --- a/src/shared/bap.h
> +++ b/src/shared/bap.h
> @@ -248,6 +248,8 @@ uint8_t bt_bap_stream_get_dir(struct bt_bap_stream 
> *stream);  uint32_t bt_bap_stream_get_location(struct bt_bap_stream 
> *stream);  struct iovec *bt_bap_stream_get_config(struct bt_bap_stream 
> *stream);  struct bt_bap_qos *bt_bap_stream_get_qos(struct 
> bt_bap_stream *stream);
> +void bt_bap_stream_set_metadata(struct bt_bap_stream *stream,
> +                                       struct iovec *meta);

There is already bt_bap_steam_metadata so Im not sure why you want to add another one that just set it locally?

>  struct iovec *bt_bap_stream_get_metadata(struct bt_bap_stream 
> *stream);
>
>  struct io *bt_bap_stream_get_io(struct bt_bap_stream *stream);
> --
> 2.25.1
>


--
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