diff mbox series

[BlueZ,v2,8/8] shared/bap: Make broadcast disable and release more consistent

Message ID 20240201191016.1122194-8-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v2,1/8] client/mgmt: Add missing settings strings | expand

Commit Message

Luiz Augusto von Dentz Feb. 1, 2024, 7:10 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes bt_bap_stream_disable and bt_bap_stream_release use disabling
and releasing states to be more consistent with their procedures.
---
 src/shared/bap.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index f2d2ca09bb24..ac17eea13556 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1377,10 +1377,14 @@  static void stream_set_state_broadcast(struct bt_bap_stream *stream,
 	case BT_ASCS_ASE_STATE_IDLE:
 		bap_stream_detach(stream);
 		break;
-	case BT_ASCS_ASE_STATE_RELEASING:
+	case BT_ASCS_ASE_STATE_DISABLING:
 		bap_stream_io_detach(stream);
 		stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_QOS);
 		break;
+	case BT_ASCS_ASE_STATE_RELEASING:
+		bap_stream_io_detach(stream);
+		stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_IDLE);
+		break;
 	}
 
 	bt_bap_unref(bap);
@@ -5064,7 +5068,7 @@  unsigned int bt_bap_stream_disable(struct bt_bap_stream *stream,
 
 	case BT_BAP_STREAM_TYPE_BCAST:
 		stream_set_state_broadcast(stream,
-					BT_BAP_STREAM_STATE_RELEASING);
+					BT_BAP_STREAM_STATE_DISABLING);
 		return 1;
 	}
 
@@ -5161,11 +5165,8 @@  unsigned int bt_bap_stream_release(struct bt_bap_stream *stream,
 
 	/* If stream is broadcast, no BT_ASCS_RELEASE is required */
 	if (bt_bap_stream_get_type(stream) == BT_BAP_STREAM_TYPE_BCAST) {
-		if (!bap_stream_valid(stream)) {
-			stream_set_state_broadcast(stream,
-					BT_BAP_STREAM_STATE_IDLE);
-			stream = NULL;
-		}
+		stream_set_state_broadcast(stream,
+					BT_BAP_STREAM_STATE_RELEASING);
 		return 0;
 	}