samples: Bluetooth: unicast audio server stop sending on stopped

When the stopped callback is called, then the CIS is disconnected.
This should stop the sending of data from the server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-09-02 10:55:17 +02:00 committed by Fabio Baltieri
parent 186181687b
commit 3d7af0f272

View file

@ -496,12 +496,21 @@ static void stream_recv(struct bt_audio_stream *stream,
#endif
static void stream_stopped(struct bt_audio_stream *stream)
{
printk("Audio Stream %p stopped\n", stream);
/* Stop send timer */
k_work_cancel_delayable(&audio_send_work);
}
static struct bt_audio_stream_ops stream_ops = {
#if defined(CONFIG_LIBLC3)
.recv = stream_recv_lc3_codec
.recv = stream_recv_lc3_codec,
#else
.recv = stream_recv
.recv = stream_recv,
#endif
.stopped = stream_stopped,
};
static void connected(struct bt_conn *conn, uint8_t err)