From db8c96059c02fefd232d49dcbeb16d6b22481100 Mon Sep 17 00:00:00 2001 From: Andrei Istodorescu Date: Thu, 16 May 2024 16:03:56 +0300 Subject: [PATCH] shared/bap: Add function to check the validity of a BIS Add utilitary function to check if the information from a BIS is matching the capabilities in bt_bap. This utilitary is used when parsing the BASE data so that we can decide if we create a new setup/stream/transport for it, or advance to the next BIS. --- src/shared/bap.c | 21 +++++++++++++++++++++ src/shared/bap.h | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index 919ecbb6a..c927ddc21 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6521,3 +6521,24 @@ void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, cleanup: util_iov_free(merge_data.result, 1); } + +void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, + struct bt_bap_codec *codec, + struct iovec *l2_caps, + struct iovec *l3_caps, + struct bt_bap_pac **lpac, + struct iovec **caps) +{ + struct bt_ltv_extract merge_data = {0}; + + merge_data.src = l3_caps; + merge_data.result = new0(struct iovec, 1); + + /* Create a Codec Specific Configuration with LTVs at level 2 (subgroup) + * overwritten by LTVs at level 3 (BIS) + */ + util_ltv_foreach(l2_caps->iov_base, + l2_caps->iov_len, + NULL, + bap_sink_check_level2_ltv, &merge_data); +} diff --git a/src/shared/bap.h b/src/shared/bap.h index 62e210485..c9cc4c3a4 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -257,3 +257,10 @@ void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, struct iovec *l3_caps, struct iovec *meta); +void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, + struct bt_bap_codec *codec, + struct iovec *l2_caps, + struct iovec *l3_caps, + struct bt_bap_pac **lpac, + struct iovec **caps); + -- 2.47.3