diff mbox series

[BlueZ,v2,13/15] shared/bap: Fix notifying with the wrong state

Message ID 20250407200124.881534-14-luiz.dentz@gmail.com
State New
Headers show
Series BAP Server test cases | expand

Commit Message

Luiz Augusto von Dentz April 7, 2025, 8:01 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

stream_notify_metadata is reused by a couple of states so it needs to
pass on the actual state to be notified rather than using ep->state
which may have been transitioned already.
---
 src/shared/bap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 76f221102dc6..be35c2e60911 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1088,7 +1088,7 @@  static void stream_notify_qos(struct bt_bap_stream *stream)
 	free(status);
 }
 
-static void stream_notify_metadata(struct bt_bap_stream *stream)
+static void stream_notify_metadata(struct bt_bap_stream *stream, uint8_t state)
 {
 	struct bt_bap_endpoint *ep = stream->ep;
 	struct bt_ascs_ase_status *status;
@@ -1106,7 +1106,7 @@  static void stream_notify_metadata(struct bt_bap_stream *stream)
 
 	memset(status, 0, len);
 	status->id = ep->id;
-	status->state = ep->state;
+	status->state = state;
 
 	meta = (void *)status->params;
 	meta->cis_id = stream->qos.ucast.cis_id;
@@ -1738,7 +1738,7 @@  static void stream_notify(struct bt_bap_stream *stream, uint8_t state)
 	case BT_ASCS_ASE_STATE_ENABLING:
 	case BT_ASCS_ASE_STATE_STREAMING:
 	case BT_ASCS_ASE_STATE_DISABLING:
-		stream_notify_metadata(stream);
+		stream_notify_metadata(stream, state);
 		break;
 	case BT_ASCS_ASE_STATE_RELEASING:
 		stream_notify_release(stream);