diff mbox series

[BlueZ,v2,3/7] bap: Create a new endpoint for the next BIS configuration

Message ID 20240212153222.8191-4-silviu.barbulescu@nxp.com
State New
Headers show
Series Add support for multiple BISes on the bcast source | expand

Commit Message

Silviu Florian Barbulescu Feb. 12, 2024, 3:32 p.m. UTC
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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 38ee42894..ffd742d7d 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -926,6 +926,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)
 {
@@ -982,6 +986,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);
 		}
 
 		if (ep->data->service)
@@ -1133,6 +1141,10 @@  static bool match_ep(const void *data, const void *user_data)
 	const struct bap_ep *ep = data;
 	const struct match_ep *match = user_data;
 
+	if ((!ep->lpac) || (!ep->rpac) ||
+		(!match->lpac) || (!match->rpac))
+		return false;
+
 	if (ep->lpac != match->lpac)
 		return false;