tests bsim: Add simple tests for broadcast audio source/sink samples

Add an initial test based on the broadcast audio source/sink samples
which runs them together and after waiting for a predefined
amount of time, checks how many audio packets has the
sink received, and if over a threshold, passes the test.

This test can be expanded after to cover more functionality from
these samples.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-11-01 16:20:13 +01:00 committed by Carles Cufí
commit b3447ec068
10 changed files with 188 additions and 5 deletions

View file

@ -81,6 +81,8 @@ static uint32_t requested_bis_sync;
static uint32_t bis_index_bitfield;
static uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
uint64_t total_rx_iso_packet_count; /* This value is exposed to test code */
#if defined(CONFIG_LIBLC3)
#include "lc3.h"
@ -182,6 +184,7 @@ static void stream_started_cb(struct bt_bap_stream *stream)
printk("Stream %p started\n", stream);
total_rx_iso_packet_count = 0U;
sink_stream->recv_cnt = 0U;
sink_stream->loss_cnt = 0U;
sink_stream->valid_cnt = 0U;
@ -234,6 +237,7 @@ static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_rec
#endif /* defined(CONFIG_LIBLC3) */
}
total_rx_iso_packet_count++;
sink_stream->recv_cnt++;
if ((sink_stream->recv_cnt % 1000U) == 0U) {
printk("Stream %p: received %u total ISO packets: Valid %u | Error %u | Loss %u\n",