diff mbox series

[BlueZ,v2,3/5] test-bap: Add support to config multiple bsrc streams

Message ID 20240625072711.7011-4-iulia.tanasescu@nxp.com
State New
Headers show
Series test-bap: Add Broadcast Source STR MBIS tests | expand

Commit Message

Iulia Tanasescu June 25, 2024, 7:27 a.m. UTC
This adds support to configure multiple bsrc streams.
---
 unit/test-bap.c | 52 ++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/unit/test-bap.c b/unit/test-bap.c
index c92c4f671..9b75cfc80 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -538,15 +538,17 @@  static void bsrc_pac_added(struct bt_bap_pac *pac, void *user_data)
 
 	bt_bap_pac_set_ops(pac, &bcast_pac_ops, NULL);
 
-	stream = bt_bap_stream_new(data->bap, pac, NULL,
-						&data->cfg->qos,
-						&data->cfg->cc);
-	g_assert(stream);
+	for (uint8_t i = 0; i < data->cfg->streams; i++) {
+		stream = bt_bap_stream_new(data->bap, pac, NULL,
+							&data->cfg->qos,
+							&data->cfg->cc);
+		g_assert(stream);
 
-	queue_push_tail(data->streams, stream);
+		queue_push_tail(data->streams, stream);
 
-	bt_bap_stream_config(stream, &data->cfg->qos,
-					&data->cfg->cc, NULL, data);
+		bt_bap_stream_config(stream, &data->cfg->qos,
+						&data->cfg->cc, NULL, data);
+	}
 }
 
 static void bsrc_state_cfg(struct bt_bap_stream *stream, uint8_t old_state,
@@ -5580,6 +5582,7 @@  static struct test_config cfg_bsrc_8_1_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_8_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_8_1_2 = {
@@ -5588,6 +5591,7 @@  static struct test_config cfg_bsrc_8_1_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_8_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_8_2_1 = {
@@ -5596,6 +5600,7 @@  static struct test_config cfg_bsrc_8_2_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_8_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_8_2_2 = {
@@ -5604,6 +5609,7 @@  static struct test_config cfg_bsrc_8_2_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_8_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_16_1_1 = {
@@ -5612,6 +5618,7 @@  static struct test_config cfg_bsrc_16_1_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_16_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_16_1_2 = {
@@ -5620,6 +5627,7 @@  static struct test_config cfg_bsrc_16_1_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_16_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_16_2_1 = {
@@ -5628,6 +5636,7 @@  static struct test_config cfg_bsrc_16_2_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_16_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_16_2_2 = {
@@ -5636,6 +5645,7 @@  static struct test_config cfg_bsrc_16_2_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_16_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_24_1_1 = {
@@ -5644,6 +5654,7 @@  static struct test_config cfg_bsrc_24_1_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_24_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_24_1_2 = {
@@ -5652,6 +5663,7 @@  static struct test_config cfg_bsrc_24_1_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_24_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_24_2_1 = {
@@ -5660,6 +5672,7 @@  static struct test_config cfg_bsrc_24_2_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_24_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_24_2_2 = {
@@ -5668,6 +5681,7 @@  static struct test_config cfg_bsrc_24_2_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_24_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_32_1_1 = {
@@ -5676,6 +5690,7 @@  static struct test_config cfg_bsrc_32_1_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_32_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_32_1_2 = {
@@ -5684,6 +5699,7 @@  static struct test_config cfg_bsrc_32_1_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_32_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_32_2_1 = {
@@ -5692,6 +5708,7 @@  static struct test_config cfg_bsrc_32_2_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_32_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_32_2_2 = {
@@ -5700,6 +5717,7 @@  static struct test_config cfg_bsrc_32_2_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_32_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_44_1_1 = {
@@ -5708,6 +5726,7 @@  static struct test_config cfg_bsrc_44_1_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_44_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_44_1_2 = {
@@ -5716,6 +5735,7 @@  static struct test_config cfg_bsrc_44_1_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_44_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_44_2_1 = {
@@ -5724,6 +5744,7 @@  static struct test_config cfg_bsrc_44_2_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_44_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_44_2_2 = {
@@ -5732,6 +5753,7 @@  static struct test_config cfg_bsrc_44_2_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_44_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_1_1 = {
@@ -5740,6 +5762,7 @@  static struct test_config cfg_bsrc_48_1_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_1_2 = {
@@ -5748,6 +5771,7 @@  static struct test_config cfg_bsrc_48_1_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_1),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_2_1 = {
@@ -5756,6 +5780,7 @@  static struct test_config cfg_bsrc_48_2_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_2_2 = {
@@ -5764,6 +5789,7 @@  static struct test_config cfg_bsrc_48_2_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_2),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_3_1 = {
@@ -5772,6 +5798,7 @@  static struct test_config cfg_bsrc_48_3_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_3),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_3_2 = {
@@ -5780,6 +5807,7 @@  static struct test_config cfg_bsrc_48_3_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_3),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_4_1 = {
@@ -5788,6 +5816,7 @@  static struct test_config cfg_bsrc_48_4_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_4),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_4_2 = {
@@ -5796,6 +5825,7 @@  static struct test_config cfg_bsrc_48_4_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_4),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_5_1 = {
@@ -5804,6 +5834,7 @@  static struct test_config cfg_bsrc_48_5_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_5),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_5_2 = {
@@ -5812,6 +5843,7 @@  static struct test_config cfg_bsrc_48_5_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_5),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_6_1 = {
@@ -5820,6 +5852,7 @@  static struct test_config cfg_bsrc_48_6_1 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_6),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 static struct test_config cfg_bsrc_48_6_2 = {
@@ -5828,6 +5861,7 @@  static struct test_config cfg_bsrc_48_6_2 = {
 	.base = UTIL_IOV_INIT(BASE_LC3_48_6),
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 #define VS_CC \
@@ -5860,6 +5894,7 @@  static struct test_config cfg_bsrc_vs = {
 	.vs = true,
 	.src = true,
 	.state_func = bsrc_state_cfg,
+	.streams = 1,
 };
 
 /* Test Purpose:
@@ -6005,6 +6040,7 @@  static struct test_config cfg_bsrc_8_1_1_estab = {
 	.qos = LC3_QOS_8_1_1_B,
 	.src = true,
 	.state_func = bsrc_state_estab,
+	.streams = 1,
 };
 
 /* Test Purpose:
@@ -6049,6 +6085,7 @@  static struct test_config cfg_bsrc_8_1_1_disable = {
 	.qos = LC3_QOS_8_1_1_B,
 	.src = true,
 	.state_func = bsrc_state_disable,
+	.streams = 1,
 };
 
 /* Test Purpose:
@@ -6094,6 +6131,7 @@  static struct test_config cfg_bsrc_8_1_1_release = {
 	.qos = LC3_QOS_8_1_1_B,
 	.src = true,
 	.state_func = bsrc_state_release,
+	.streams = 1,
 };
 
 /* Test Purpose: