diff mbox series

[BlueZ,4/5] shared/bap: In case of a BIS-PAC match return also the local pac

Message ID 20240419180752.96699-5-andrei.istodorescu@nxp.com (mailing list archive)
State Superseded
Headers show
Series Create transports for matching BISes | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Andrei Istodorescu April 19, 2024, 6:07 p.m. UTC
When checking in local PACS for a BIS match return also the local PAC,
along with the status of the operation. This information is required
later when we create the stream.
---
 src/shared/bap.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index d7a2f9381c53..8c4868f4bf9f 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -6400,9 +6400,11 @@  static void check_local_pac(void *data, void *user_data)
 
 		/* We have a match if all selected LTVs have a match */
 		if ((bis_compare_data.data32 &
-			CODEC_SPECIFIC_CONFIGURATION_MASK) ==
-			CODEC_SPECIFIC_CONFIGURATION_MASK)
+				CODEC_SPECIFIC_CONFIGURATION_MASK) ==
+				CODEC_SPECIFIC_CONFIGURATION_MASK) {
 			compare_data->found = true;
+			compare_data->data = data;
+		}
 	}
 }
 
@@ -6427,7 +6429,8 @@  static void bap_sink_match_allocation(size_t i, uint8_t l, uint8_t t,
 		data->found = false;
 }
 
-static bool bap_check_bis(struct bt_bap_db *ldb, struct iovec *bis_data)
+static struct bt_ltv_match bap_check_bis(struct bt_bap_db *ldb,
+	struct iovec *bis_data)
 {
 	struct bt_ltv_match compare_data = {};
 
@@ -6453,7 +6456,7 @@  static bool bap_check_bis(struct bt_bap_db *ldb, struct iovec *bis_data)
 				&compare_data);
 	}
 
-	return compare_data.found;
+	return compare_data;
 }
 
 void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index,
@@ -6468,6 +6471,7 @@  void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index,
 	struct bt_bap_pac_qos bis_qos = {0};
 	uint8_t type = 0;
 	struct bt_ltv_extract merge_data = {0};
+	struct bt_ltv_match match_data = {0};
 
 	merge_data.src = l3_caps;
 	merge_data.result = new0(struct iovec, 1);
@@ -6483,7 +6487,8 @@  void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index,
 	/* Check each BIS Codec Specific Configuration LTVs against our Codec
 	 * Specific Capabilities and if the BIS matches create a PAC with it
 	 */
-	if (bap_check_bis(bap->ldb, merge_data.result) == false)
+	match_data = bap_check_bis(bap->ldb, merge_data.result);
+	if (match_data.found == false)
 		goto cleanup;
 
 	DBG(bap, "Matching BIS %i", bis_index);