Skip to content

Commit c82adf5

Browse files
Thalleynashif
authored andcommitted
tests: Bluetooth: BAP: Use fallbacks for bcast bsim tests
Use fallbacks in codec cfg functions in the BAP broadcast babblesim tests to avoid unnecessary noise in the logs of the tests. Signed-off-by: Emil Gydesen <[email protected]>
1 parent fcdfdae commit c82adf5

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ static bool valid_base_subgroup(const struct bt_bap_base_subgroup *subgroup)
138138
return false;
139139
}
140140

141-
ret = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation, false);
141+
ret = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation, true);
142142
if (ret == 0) {
143143
chan_cnt = bt_audio_get_chan_count(chan_allocation);
144144
} else {
145-
printk("Could not get subgroup channel allocation: %d\n", ret);
146-
/* Channel allocation is an optional field, and omitting it implicitly means mono */
147-
chan_cnt = 1U;
145+
FAIL("Could not get subgroup channel allocation: %d\n", ret);
146+
147+
return false;
148148
}
149149

150150
if (chan_cnt == 0 || (BIT(chan_cnt - 1) & SUPPORTED_CHAN_COUNTS) == 0) {
@@ -169,13 +169,13 @@ static bool valid_base_subgroup(const struct bt_bap_base_subgroup *subgroup)
169169
return false;
170170
}
171171

172-
ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(&codec_cfg, false);
172+
ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(&codec_cfg, true);
173173
if (ret > 0) {
174174
frames_blocks_per_sdu = (uint8_t)ret;
175175
} else {
176-
printk("Could not get subgroup octets per frame: %d\n", ret);
177-
/* Frame blocks per SDU is optional and is implicitly 1 */
178-
frames_blocks_per_sdu = 1U;
176+
FAIL("Could not get frame blocks per SDU: %d\n", ret);
177+
178+
return false;
179179
}
180180

181181
/* An SDU can consist of X frame blocks, each with Y frames (one per channel) of size Z in
@@ -460,7 +460,7 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream)
460460
/* The broadcast source sets the channel allocation in the BIS to
461461
* BT_AUDIO_LOCATION_FRONT_LEFT
462462
*/
463-
ret = bt_audio_codec_cfg_get_chan_allocation(codec_cfg, &chan_allocation, false);
463+
ret = bt_audio_codec_cfg_get_chan_allocation(codec_cfg, &chan_allocation, true);
464464
if (ret == 0) {
465465
if (chan_allocation != BT_AUDIO_LOCATION_FRONT_CENTER) {
466466
FAIL("Unexpected channel allocation: 0x%08X", chan_allocation);
@@ -497,13 +497,12 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream)
497497
return;
498498
}
499499

500-
ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(codec_cfg, false);
500+
ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(codec_cfg, true);
501501
if (ret > 0) {
502502
frames_blocks_per_sdu = (uint8_t)ret;
503503
} else {
504-
printk("Could not get octets per frame: %d\n", ret);
505-
/* Frame blocks per SDU is optional and is implicitly 1 */
506-
frames_blocks_per_sdu = 1U;
504+
FAIL("Could not get frame blocks per SDU: %d\n", ret);
505+
return;
507506
}
508507

509508
/* An SDU can consist of X frame blocks, each with Y frames (one per channel) of size Z in

tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream)
113113
/* The broadcast source sets the channel allocation in the BIS to
114114
* BT_AUDIO_LOCATION_FRONT_CENTER
115115
*/
116-
ret = bt_audio_codec_cfg_get_chan_allocation(codec_cfg, &chan_allocation, false);
116+
ret = bt_audio_codec_cfg_get_chan_allocation(codec_cfg, &chan_allocation, true);
117117
if (ret == 0) {
118118
if (chan_allocation != BT_AUDIO_LOCATION_FRONT_CENTER) {
119119
FAIL("Unexpected channel allocation: 0x%08X", chan_allocation);
@@ -150,13 +150,13 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream)
150150
return;
151151
}
152152

153-
ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(codec_cfg, false);
153+
ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(codec_cfg, true);
154154
if (ret > 0) {
155155
frames_blocks_per_sdu = (uint8_t)ret;
156156
} else {
157-
printk("Could not get octets per frame: %d\n", ret);
158-
/* Frame blocks per SDU is optional and is implicitly 1 */
159-
frames_blocks_per_sdu = 1U;
157+
FAIL("Could not get frame blocks per SDU: %d\n", ret);
158+
159+
return;
160160
}
161161

162162
/* An SDU can consist of X frame blocks, each with Y frames (one per channel) of size Z in

0 commit comments

Comments
 (0)