2024-01-29 15:36:39

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 2/3] shared/bap: Set bcast stream metadata

This updates bt_bap_stream_metadata to handle broadcast streams,
by setting stream medatada.
---
src/shared/bap.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 06cac5bb3..851d6a5fa 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -4,7 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2022 Intel Corporation. All rights reserved.
- * Copyright 2023 NXP
+ * Copyright 2023-2024 NXP
*
*/

@@ -5114,13 +5114,21 @@ unsigned int bt_bap_stream_metadata(struct bt_bap_stream *stream,
if (!stream)
return 0;

- if (!stream->client) {
- stream_metadata(stream, metadata, NULL);
+ switch (bt_bap_stream_get_type(stream)) {
+ case BT_BAP_STREAM_TYPE_UCAST:
+ if (!stream->client) {
+ stream_metadata(stream, metadata, NULL);
+ return 0;
+ }
+ return bap_stream_metadata(stream, BT_ASCS_METADATA,
+ metadata, func, user_data);
+ case BT_BAP_STREAM_TYPE_BCAST:
+ util_iov_free(stream->meta, 1);
+ stream->meta = util_iov_dup(metadata, 1);
+ return 1;
+ default:
return 0;
}
-
- return bap_stream_metadata(stream, BT_ASCS_METADATA, metadata, func,
- user_data);
}

unsigned int bt_bap_stream_release(struct bt_bap_stream *stream,
--
2.39.2