Skip to content

Commit 18ab7eb

Browse files
MariuszSkamracarlescufi
authored andcommitted
samples: unicast_audio_client: Fix enabling the streams
This fixes the application that was not waiting for QoS configuration of all streams in the group. The QoS operation is done on group of streams, while the status of each one of the streams is received separately. Meaning that the application has to control which streams were already configured before enabling them. Signed-off-by: Mariusz Skamra <[email protected]>
1 parent f30eb1b commit 18ab7eb

File tree

1 file changed

+4
-5
lines changed
  • samples/bluetooth/unicast_audio_client/src

1 file changed

+4
-5
lines changed

samples/bluetooth/unicast_audio_client/src/main.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static K_SEM_DEFINE(sem_security_updated, 0, 1);
5353
static K_SEM_DEFINE(sem_sinks_discovered, 0, 1);
5454
static K_SEM_DEFINE(sem_sources_discovered, 0, 1);
5555
static K_SEM_DEFINE(sem_stream_configured, 0, 1);
56-
static K_SEM_DEFINE(sem_stream_qos, 0, 1);
56+
static K_SEM_DEFINE(sem_stream_qos, 0, ARRAY_SIZE(sinks) + ARRAY_SIZE(sources));
5757
static K_SEM_DEFINE(sem_stream_enabled, 0, 1);
5858
static K_SEM_DEFINE(sem_stream_started, 0, 1);
5959

@@ -952,10 +952,9 @@ static int set_stream_qos(void)
952952
return err;
953953
}
954954

955-
err = k_sem_take(&sem_stream_qos, K_FOREVER);
956-
if (err != 0) {
957-
printk("failed to take sem_stream_qos (err %d)\n", err);
958-
return err;
955+
for (size_t i = 0U; i < configured_stream_count; i++) {
956+
printk("QoS: waiting for %zu streams\n", configured_stream_count);
957+
k_sem_take(&sem_stream_qos, K_FOREVER);
959958
}
960959

961960
return 0;

0 commit comments

Comments
 (0)