Bluetooth: BAP: Reset _prev_seq_num on ISO connection

Once an ISO channel has connected, the sequence number
always starts at 0. This reset was missing in the implementation,
and the _prev_seq_num from a previous connection may have
been kept.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-02-08 13:39:33 +01:00 committed by Carles Cufí
commit 7cfc8b3340
3 changed files with 15 additions and 0 deletions

View file

@ -968,6 +968,11 @@ static void ascs_ep_iso_connected(struct bt_bap_ep *ep)
LOG_DBG("stream %p ep %p dir %s", stream, ep, bt_audio_dir_str(ep->dir));
#if defined(CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM)
/* reset sequence number */
stream->_prev_seq_num = 0U;
#endif /* CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM */
stream_ops = stream->ops;
if (stream_ops != NULL && stream_ops->connected != NULL) {
stream_ops->connected(stream);

View file

@ -168,6 +168,11 @@ static void broadcast_source_iso_connected(struct bt_iso_chan *chan)
LOG_DBG("stream %p ep %p", stream, ep);
#if defined(CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM)
/* reset sequence number */
stream->_prev_seq_num = 0U;
#endif /* CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM */
ops = stream->ops;
if (ops != NULL && ops->connected != NULL) {
ops->connected(stream);

View file

@ -315,6 +315,11 @@ static void unicast_client_ep_iso_connected(struct bt_bap_ep *ep)
LOG_DBG("stream %p ep %p dir %s receiver_ready %u",
stream, ep, bt_audio_dir_str(ep->dir), ep->receiver_ready);
#if defined(CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM)
/* reset sequence number */
stream->_prev_seq_num = 0U;
#endif /* CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM */
stream_ops = stream->ops;
if (stream_ops != NULL && stream_ops->connected != NULL) {
stream_ops->connected(stream);