diff mbox series

[BlueZ,5/9] shared/bap: Add guard for broadcast sink

Message ID 20241004123523.1012743-6-vlad.pruteanu@nxp.com
State New
Headers show
Series Allow syncing to multiple BISes from the same BIG | expand

Commit Message

Vlad Pruteanu Oct. 4, 2024, 12:35 p.m. UTC
BT_ASCS_ASE_STATE_RELEASING has the same value as
BT_BAP_STREAM_STATE_RELEASING, so a guard must be placed here.
Until now the RELEASING state was not used for broadcast sinks,
so this was not an issue.
---
 src/shared/bap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 72f0f8a03..c69c9bf6c 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2098,8 +2098,10 @@  static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state)
 			stream->ops->detach(stream);
 		break;
 	case BT_ASCS_ASE_STATE_RELEASING:
-		bap_stream_io_detach(stream);
-		stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE);
+		if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) {
+			bap_stream_io_detach(stream);
+			stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE);
+		}
 		break;
 	}
 }