diff mbox series

[BlueZ,8/9] bap: Update broadcast sink state machine

Message ID 20241004123523.1012743-9-vlad.pruteanu@nxp.com (mailing list archive)
State New, archived
Headers show
Series Allow syncing to multiple BISes from the same BIG | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS

Commit Message

Vlad Pruteanu Oct. 4, 2024, 12:35 p.m. UTC
This updates the state machine for broadcast sinks such that
setup_create_io is now called on the enabling state. This is
change is required to support the new, sync to multiple BISes
mechanism, which will change the stream's state from PENDING to
ENABLING and finally STREAMING.
---
 profiles/audio/bap.c | 8 +++++---
 src/shared/bap.c     | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 7251d8759..75be494af 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -2748,13 +2748,15 @@  static void bap_state_bcast_sink(struct bt_bap_stream *stream,
 	case BT_BAP_STREAM_STATE_CONFIG:
 		if (!setup)
 			break;
-		if (old_state ==
-				BT_BAP_STREAM_STATE_CONFIG)
-			setup_create_io(data, setup, stream, defer);
 		if (old_state ==
 				BT_BAP_STREAM_STATE_STREAMING)
 			setup_io_close(setup, NULL);
 		break;
+	case BT_BAP_STREAM_STATE_ENABLING:
+		if (!setup)
+			break;
+		setup_create_io(data, setup, stream, defer);
+		break;
 	}
 }
 
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 122f72665..49db341cb 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2116,7 +2116,7 @@  static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream,
 					bt_bap_stream_func_t func,
 					void *user_data)
 {
-	stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
+	stream_set_state(stream, BT_BAP_STREAM_STATE_ENABLING);
 
 	return 1;
 }