According to the BAP spec, the level 3 of the BASE contains codec configuration LTVs specific to each BIS, in addition to the configuration provided at level 2 (subgroup level) (v1.0.1, section 3.7.2.2 Basic Audio Announcements). Currently, when a Broadcast Sink parses the BASE discovered from a Broadcast Source, level 3 LTV types that are not also present at level 2 are not included in the final BIS cofiguration, causing incorrect stream handling. This updates the BASE parsing logic to consider level 3 LTVs. --- src/shared/bap.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 167501282..6ffeefa41 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-2024 NXP + * Copyright 2023-2025 NXP * */ @@ -6921,6 +6921,24 @@ static void bap_sink_check_level2_ltv(size_t i, uint8_t l, uint8_t t, util_ltv_push(merge_data->result, l, t, v); } +static void bap_sink_append_level3_ltv(size_t i, uint8_t l, uint8_t t, + uint8_t *v, void *user_data) +{ + struct bt_ltv_extract *merge_data = user_data; + + merge_data->value = NULL; + util_ltv_foreach(merge_data->result->iov_base, + merge_data->result->iov_len, + &t, + bap_sink_check_level3_ltv, merge_data); + + /* If the LTV at level 3 was not found in merged configuration, + * append value + */ + if (!merge_data->value) + util_ltv_push(merge_data->result, l, t, v); +} + static void check_local_pac(void *data, void *user_data) { struct bt_ltv_match *compare_data = user_data; @@ -7028,6 +7046,14 @@ struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps) NULL, bap_sink_check_level2_ltv, &merge_data); + /* Append LTVs at level 3 (BIS) that were not found at + * level 2 (subgroup) + */ + util_ltv_foreach(l3_caps->iov_base, + l3_caps->iov_len, + NULL, + bap_sink_append_level3_ltv, &merge_data); + return merge_data.result; } -- 2.43.0