diff mbox series

[BlueZ,v1,2/2] bap: Fix not handling out of order responses

Message ID 20240123190427.3031698-2-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit d994c9d45dad68bc060add77642fdc37834cd7c1
Headers show
Series [BlueZ,v1,1/2] bap: Add missing Metadata property | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz Jan. 23, 2024, 7:04 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

When EATT is enabled it is possible that response are generated out of
order, since they may come from different sockets/fds, so this attempts
to detect when that happens by checking if the state has already been
changed.
---
 profiles/audio/bap.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 6184c9d178a8..a4036bbbdfa8 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -801,8 +801,20 @@  static void config_cb(struct bt_bap_stream *stream,
 
 	setup->id = 0;
 
-	if (!code)
+	if (!code) {
+		/* Check state is already set to config then proceed to qos */
+		if (bt_bap_stream_get_state(stream) ==
+					BT_BAP_STREAM_STATE_CONFIG) {
+			setup->id = bt_bap_stream_qos(stream, &setup->qos,
+							qos_cb, setup);
+			if (!setup->id) {
+				error("Failed to Configure QoS");
+				bt_bap_stream_release(stream, NULL, NULL);
+			}
+		}
+
 		return;
+	}
 
 	if (!setup->msg)
 		return;