diff mbox series

[BlueZ,6/9] shared/bap: Add PENDING state for streams

Message ID 20241004123523.1012743-7-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 adds the PENDING state for streams, which will be used to
signal that the stream is part of a multiple BISes sync and that
it needs to be reacquired. bap_bcast_sink_enable has also been
updated so that the stream ca go from PENDING to ENABLING.
---
 src/shared/bap-defs.h |  1 +
 src/shared/bap.c      | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/shared/bap-defs.h b/src/shared/bap-defs.h
index 27fefa34f..eba98d0e6 100644
--- a/src/shared/bap-defs.h
+++ b/src/shared/bap-defs.h
@@ -30,6 +30,7 @@ 
 #define BT_BAP_STREAM_STATE_STREAMING	0x04
 #define BT_BAP_STREAM_STATE_DISABLING	0x05
 #define BT_BAP_STREAM_STATE_RELEASING	0x06
+#define BT_BAP_STREAM_STATE_PENDING		0x07
 
 #define BT_BAP_CONFIG_LATENCY_LOW	0x01
 #define BT_BAP_CONFIG_LATENCY_BALANCED	0x02
diff --git a/src/shared/bap.c b/src/shared/bap.c
index c69c9bf6c..122f72665 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2146,7 +2146,13 @@  static unsigned int bap_bcast_disable(struct bt_bap_stream *stream,
 					void *user_data)
 {
 	bap_stream_io_detach(stream);
-	stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
+	if (bt_bap_stream_get_state(stream) == BT_BAP_STREAM_STATE_RELEASING)
+		/* Change state to PENDING, signifying that the transport for
+		 * this stream should be reacquired.
+		 */
+		stream_set_state(stream, BT_BAP_STREAM_STATE_PENDING);
+	else
+		stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
 
 	return 1;
 }
@@ -5200,6 +5206,8 @@  const char *bt_bap_stream_statestr(uint8_t state)
 		return "disabling";
 	case BT_BAP_STREAM_STATE_RELEASING:
 		return "releasing";
+	case BT_BAP_STREAM_STATE_PENDING:
+		return "pending";
 	}
 
 	return "unknown";