diff mbox series

[BlueZ,1/1] bap: Wait for BIG Info report event before creating streams

Message ID 20240709085903.125001-2-vlad.pruteanu@nxp.com (mailing list archive)
State Accepted
Commit 2748c60a2c6b1b090a7507fdd23865a598129d61
Headers show
Series bap: Wait for BIG Info report event before creating streams | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Vlad Pruteanu July 9, 2024, 8:59 a.m. UTC
This makes it so that stream for each BIS is created after BIG
Info report is received. This ensures that when the stream is
created the encryption field is correctly set.
---
 profiles/audio/bap.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com July 9, 2024, 10:40 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=869563

---Test result---

Test Summary:
CheckPatch                    PASS      0.50 seconds
GitLint                       PASS      0.31 seconds
BuildEll                      PASS      24.49 seconds
BluezMake                     PASS      1679.28 seconds
MakeCheck                     PASS      12.94 seconds
MakeDistcheck                 PASS      176.35 seconds
CheckValgrind                 PASS      250.71 seconds
CheckSmatch                   PASS      351.87 seconds
bluezmakeextell               PASS      119.10 seconds
IncrementalBuild              PASS      1444.30 seconds
ScanBuild                     PASS      998.47 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index e82a25382..afa938091 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -134,6 +134,7 @@  struct bap_bcast_pa_req {
 		struct btd_service *service;
 		struct bap_setup *setup;
 	} data;
+	unsigned int io_id;	/* io_id for BIG Info watch */
 };
 
 static struct queue *sessions;
@@ -1220,7 +1221,8 @@  fail:
 	return ret;
 }
 
-static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
+static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond,
+							gpointer user_data)
 {
 	GError *err = NULL;
 	struct bap_bcast_pa_req *req = user_data;
@@ -1228,7 +1230,7 @@  static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
 	struct bt_iso_base base;
 	struct bt_iso_qos qos;
 
-	DBG("PA Sync done");
+	DBG("BIG Info received");
 
 	bt_io_get(io, &err,
 			BT_IO_OPT_BASE, &base,
@@ -1238,7 +1240,8 @@  static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
 		error("%s", err->message);
 		g_error_free(err);
 		g_io_channel_shutdown(io, TRUE, NULL);
-		return;
+		req->io_id = 0;
+		return FALSE;
 	}
 
 	/* Close the io and remove the queue request for another PA Sync */
@@ -1255,7 +1258,21 @@  static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
 	service_set_connecting(req->data.service);
 
 	queue_remove(data->adapter->bcast_pa_requests, req);
+	req->io_id = 0;
 	free(req);
+
+	return FALSE;
+}
+
+static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
+{
+	struct bap_bcast_pa_req *req = user_data;
+	/* PA Sync was established, wait for BIG Info report so that the
+	 * encryption flag is also available.
+	 */
+	DBG("PA Sync done");
+	req->io_id = g_io_add_watch(io, G_IO_OUT, big_info_report_cb,
+								user_data);
 }
 
 static bool match_data_bap_data(const void *data, const void *match_data)
@@ -3177,6 +3194,10 @@  static void bap_bcast_remove(struct btd_service *service)
 	 */
 	req = queue_remove_if(data->adapter->bcast_pa_requests,
 						match_service, service);
+	if (req->io_id) {
+		g_source_remove(req->io_id);
+		req->io_id = 0;
+	}
 	free(req);
 
 	bap_data_remove(data);