[PATCH BlueZ 3/7] bap: Create a new endpoint to be available for the next BIS configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add support to create a new endpoint to be available for the next
BIS configuration.
Broadcast source requires the creation of multiple endpoints, one
for each BIS for the multiple BISes scenario.

---
 profiles/audio/bap.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 209f21471..9300e98ec 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -916,6 +916,10 @@ static void setup_free(void *data)
 	free(setup);
 }
 
+static struct bap_ep *ep_register_bcast(struct bap_data *data,
+					struct bt_bap_pac *lpac,
+					struct bt_bap_pac *rpac);
+
 static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
 								void *data)
 {
@@ -972,6 +976,10 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
 		else {
 			setup->base = bt_bap_stream_get_base(setup->stream);
 			setup->id = 0;
+			/* Create a new endpoint for a new BIS */
+			if (!ep_register_bcast(ep->data, ep->lpac, ep->rpac))
+				error("Unable to register endpoint for pac %p",
+						ep->lpac);
 		}
 
 		return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
@@ -1150,9 +1158,14 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data,
 		return NULL;
 	}
 
-	ep = queue_find(queue, match_ep, &match);
-	if (ep)
-		return ep;
+	/* Broadcast source creates multiple endpoints (multiple BISes)
+	 * for one pac so queue_find will return always true.
+	 */
+	if (bt_bap_pac_get_type(lpac) == BT_BAP_BCAST_SINK) {
+		ep = queue_find(queue, match_ep, &match);
+		if (ep)
+			return ep;
+	}
 
 	ep = new0(struct bap_ep, 1);
 	ep->data = data;
-- 
2.39.2





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux