aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndrei Istodorescu <andrei.istodorescu@nxp.com>2024-04-19 21:07:49 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-04-23 10:35:48 -0400
commit30b741baa569bc3dceabb24f2e6a9e7fe1bb87e0 (patch)
tree4f90a0fc7186314b323a2e4b517a315f5df02c68
parent5b4d9abfdeee44dd9b70113fccf4c16f07350f79 (diff)
shared/bap: Get broadcast channel location from stream capabilities
Get the channel location from the stream's configured capabilities, rather than from the local PACS database capabilities.
-rw-r--r--src/shared/bap.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 6328ff35f3..36f0b0a3b5 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5628,9 +5628,24 @@ uint8_t bt_bap_stream_get_dir(struct bt_bap_stream *stream)
return BT_BAP_BCAST_SINK;
}
+static void bap_sink_get_allocation(size_t i, uint8_t l, uint8_t t,
+ uint8_t *v, void *user_data)
+{
+ uint32_t location32;
+
+ if (!v)
+ return;
+
+ memcpy(&location32, v, l);
+ *((uint32_t *)user_data) = le32_to_cpu(location32);
+}
+
uint32_t bt_bap_stream_get_location(struct bt_bap_stream *stream)
{
struct bt_pacs *pacs;
+ uint8_t type = BAP_CHANNEL_ALLOCATION_LTV_TYPE;
+ uint32_t allocation = 0;
+ struct iovec *caps;
if (!stream)
return 0x00000000;
@@ -5644,10 +5659,13 @@ uint32_t bt_bap_stream_get_location(struct bt_bap_stream *stream)
return pacs->sink_loc_value;
}
- /* TO DO get the location values from metadata
- * for brodcast source and sink
- */
- return stream->bap->ldb->pacs->source_loc_value;
+ caps = bt_bap_stream_get_config(stream);
+
+ /* Get stream allocation from capabilities */
+ util_ltv_foreach(caps->iov_base, caps->iov_len, &type,
+ bap_sink_get_allocation, &allocation);
+
+ return allocation;
}
struct iovec *bt_bap_stream_get_config(struct bt_bap_stream *stream)
@@ -6322,18 +6340,6 @@ struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream)
return base_iov;
}
-static void bap_sink_get_allocation(size_t i, uint8_t l, uint8_t t,
- uint8_t *v, void *user_data)
-{
- uint32_t location32;
-
- if (!v)
- return;
-
- memcpy(&location32, v, l);
- *((uint32_t *)user_data) = le32_to_cpu(location32);
-}
-
/*
* This function compares PAC Codec Specific Capabilities, with the Codec
* Specific Configuration LTVs received in the BASE of the BAP Source. The