Bluetooth: Audio: Ensure that stream is in streaming state for ISO recv

Adds check to verify that the audio stream is actually
in the streaming state before handling the
audio data. As per the BAP spec, a stream that
is not in the streaming state shall not send
any data, and this check is to handle any
remote devices that are not working correctly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-10-05 15:04:29 +02:00 committed by Carles Cufí
parent fb43a48065
commit 4321fef3b7
2 changed files with 26 additions and 0 deletions

View file

@ -458,6 +458,19 @@ static void ascs_iso_recv(struct bt_iso_chan *chan,
return;
}
/* Since 2 streams can share the same CIS, the CIS may be connected and
* capable of transferring data, without the bt_audio_stream being in
* the streaming state. In that case we simply ignore the data.
*/
if (stream->ep->status.state != BT_AUDIO_EP_STATE_STREAMING) {
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
BT_DBG("Stream %p is not in the streaming state: %u",
stream, stream->ep->status.state);
}
return;
}
ops = stream->ops;
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {

View file

@ -95,6 +95,19 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan,
return;
}
/* Since 2 streams can share the same CIS, the CIS may be connected and
* capable of transferring data, without the bt_audio_stream being in
* the streaming state. In that case we simply ignore the data.
*/
if (stream->ep->status.state != BT_AUDIO_EP_STATE_STREAMING) {
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
BT_DBG("Stream %p is not in the streaming state: %u",
stream, stream->ep->status.state);
}
return;
}
ops = stream->ops;
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {