From 699eecf2abff9a33a7d0f2700db2335641c9fc1a Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 11 Sep 2023 20:25:41 +0200 Subject: [PATCH] tests: bsim: Bluetooth: BAP Broadcast update to 2 bis Update the bsim test for the BAP broadcast to use 2 bis. This tests a larger part of the code, and also verifies that we can send and receive on 2 BIS without any ISO errors. This requires the ADV interval to be a multiple of ISO interval - 10ms, so the advertising interval has been set to 80ms. Signed-off-by: Emil Gydesen --- tests/bsim/bluetooth/audio/prj.conf | 9 +++++---- tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c | 2 ++ .../bsim/bluetooth/audio/src/bap_broadcast_source_test.c | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 06114766881440f..3f8f6cef48b5b3f 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -30,10 +30,10 @@ CONFIG_BT_BAP_BROADCAST_SOURCE=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=196 CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE=196 -CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=1 +CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2 CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1 CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=1 -CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=1 +CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2 CONFIG_BT_ISO_TX_BUF_COUNT=4 CONFIG_BT_ISO_MAX_CHAN=4 CONFIG_BT_ISO_TX_MTU=310 @@ -200,8 +200,9 @@ CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 # Controller ISO Broadcast Settings -CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=1 -CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=1 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # Controller ISO Unicast Settings CONFIG_BT_CTLR_CENTRAL_ISO=y diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c index 1f7c91288c8cb82..548bea91859c7ee 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c @@ -308,6 +308,8 @@ static void recv_cb(struct bt_bap_stream *stream, if (memcmp(buf->data, mock_iso_data, buf->len) == 0) { test_stream->rx_cnt++; + printk("test_stream->rx_cnt %u\n", test_stream->rx_cnt); + if (test_stream->rx_cnt >= MIN_SEND_COUNT) { /* We set the flag is just one stream has received the expected */ SET_FLAG(flag_received); diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c index 5410d76defaffb4..1559f8c30108d1c 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c @@ -121,7 +121,7 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source) } for (size_t i = 0U; i < ARRAY_SIZE(subgroup_params); i++) { - subgroup_params[i].params_count = 1U; + subgroup_params[i].params_count = ARRAY_SIZE(stream_params); subgroup_params[i].params = &stream_params[i]; subgroup_params[i].codec_cfg = &preset_16_1_1.codec_cfg; } @@ -178,6 +178,8 @@ static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_ /* Broadcast Audio Streaming Endpoint advertising data */ NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE); + struct bt_le_adv_param adv_param = BT_LE_ADV_PARAM_INIT( + BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_USE_NAME, 0x80, 0x80, NULL); NET_BUF_SIMPLE_DEFINE(base_buf, 128); struct bt_data ext_ad; struct bt_data per_ad; @@ -185,7 +187,7 @@ static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_ int err; /* Create a non-connectable non-scannable advertising set */ - err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN_NAME, NULL, adv); + err = bt_le_ext_adv_create(&adv_param, NULL, adv); if (err != 0) { printk("Unable to create extended advertising set: %d\n", err); return err;