samples: unicast audio: Wrap start of the send timer

Enable the send timer only when at least one ASE source is enabled,
CONFIG_BT_ASCS_ASE_SRC_COUNT > 0 in case of unicast_audio_server,
CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0 for unicast_audio_client.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
This commit is contained in:
Magdalena Kasenberg 2023-06-01 11:15:02 +02:00 committed by Anas Nashif
parent 4da3fc9c32
commit 169812f84c
2 changed files with 8 additions and 3 deletions

View file

@ -1101,8 +1101,10 @@ int main(void)
}
printk("Streams started\n");
/* Start send timer */
k_work_schedule(&audio_send_work, K_MSEC(0));
if (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0) {
/* Start send timer */
k_work_schedule(&audio_send_work, K_MSEC(0));
}
/* Wait for disconnect */
err = k_sem_take(&sem_disconnected, K_FOREVER);

View file

@ -782,7 +782,10 @@ int main(void)
printk("Advertising successfully started\n");
k_work_init_delayable(&audio_send_work, audio_timer_timeout);
if (CONFIG_BT_ASCS_ASE_SRC_COUNT > 0) {
/* Start send timer */
k_work_init_delayable(&audio_send_work, audio_timer_timeout);
}
err = k_sem_take(&sem_disconnected, K_FOREVER);
if (err != 0) {