Subject: [PATCH BlueZ 0/7] Add support for multiple BISes on the bcast source

This patch adds support for multiple BISes in broadcast sources.

Example commands:
Create a local endpoint and an endpoint for BIS1:
endpoint.register 00001852-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] Max Transports (auto/value): a
[/local/endpoint/ep0] Locations: 0x03
[/local/endpoint/ep0] Supported Context (value): 0

Configure BIS1, create BIS1 transport and endpoint for BIS2:
endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 48_4_1
[/local/endpoint/ep0] BIG (auto/value): 0x01
[/local/endpoint/ep0] Enter channel location (value/no): 0x01
[/local/endpoint/ep0] Enter Metadata (value/no): n

Configure BIS2, create BIS2 transport and endpoint for BIS3:
endpoint.config /org/bluez/hci0/pac_bcast1 /local/endpoint/ep0 48_4_1
[/local/endpoint/ep0] BIG (auto/value): 0x01
[/local/endpoint/ep0] Enter channel location (value/no): 0x02
[/local/endpoint/ep0] Enter Metadata (value/no): n

For multiple BISes acquire must be called on all transports
before the BIG is created:
transport.acquire /org/bluez/hci0/pac_bcast0/fd0
transport.acquire /org/bluez/hci0/pac_bcast1/fd1
.....
transport.release /org/bluez/hci0/pac_bcast0/fd0
transport.release /org/bluez/hci0/pac_bcast1/fd1

Silviu Florian Barbulescu (7):
bap: Remove set lpac user data at bcast ep register
shared/bap: Add support to create multiple streams for the same pac
bap: Create a new endpoint to be available for the next BIS
configuration
bap: Split bap_state and bap_connecting in two functions
shared/bap: Check the state of all the streams with the same BIG ID
bap: Set the generated BASE on all setups from the same BIG
shared/bap: Generate single BIS BASE for a configuration with BIG ID
0xFF

profiles/audio/bap.c | 239 ++++++++++++++++++++++++++++++++-----------
src/shared/bap.c | 67 ++++++++++--
src/shared/bap.h | 2 +
3 files changed, 238 insertions(+), 70 deletions(-)


base-commit: a692cc44dc8735b9303f8893f784306b4d2654fe
--
2.39.2



Subject: [PATCH BlueZ 2/7] shared/bap: Add support to create multiple streams for the same pac

Broadcast source requires to create multiple streams for one pac.
This is required for multiple BISes support.

---
src/shared/bap.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 851d6a5fa..a4c6a1bcd 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -4739,7 +4739,7 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
struct iovec *data)
{
struct bt_bap_stream *stream;
- struct bt_bap_endpoint *ep;
+ struct bt_bap_endpoint *ep = NULL;
struct match_pac match;

if (!bap)
@@ -4795,12 +4795,32 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
match.lpac = lpac;
match.rpac = rpac;

- /* Check for existing stream */
- ep = queue_find(bap->remote_eps, find_ep_pacs, &match);
+ /* Broadcast source supports multiple endpoints (multiple BISes)
+ * for one pac so allow it to register a new endpoint even if
+ * others already exist.
+ */
+ if (lpac->type != BT_BAP_BCAST_SOURCE) {
+ /* Check for existing stream */
+ ep = queue_find(bap->remote_eps, find_ep_pacs, &match);
+ }
+
if (!ep) {
/* Check for unused ASE */
ep = queue_find(bap->remote_eps, find_ep_unused, &match);
- if (!ep) {
+ if (!ep && lpac->type == BT_BAP_BCAST_SOURCE) {
+ /* Push a new remote endpoint with direction
+ * broadcast source
+ */
+ ep = bap_endpoint_new_broadcast(bap->rdb,
+ BT_BAP_BCAST_SOURCE);
+
+ if (ep)
+ queue_push_tail(bap->remote_eps, ep);
+ else {
+ DBG(bap, "Unable to create endpoint");
+ return NULL;
+ }
+ } else if (!ep) {
DBG(bap, "Unable to find unused ASE");
return NULL;
}
--
2.39.2


Subject: [PATCH BlueZ 1/7] bap: Remove set lpac user data at bcast ep register

Fix a wrongful set of user data with endpoint pat for the local PAC.
Local pac user data is set endpoint_init_pac form media.c
with the media_endpoint

---
profiles/audio/bap.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 7faa6be7f..209f21471 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1195,8 +1195,6 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data,
*/
if (rpac)
bt_bap_pac_set_user_data(rpac, ep->path);
- else
- bt_bap_pac_set_user_data(lpac, ep->path);

DBG("ep %p lpac %p rpac %p path %s", ep, ep->lpac, ep->rpac, ep->path);

--
2.39.2


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

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


Subject: [PATCH BlueZ 6/7] bap: Set the generated BASE on all setups from the same BIG

Set the BASE generated in BlueZ on all setups from the same BIG,
and use defer to inform the kernel when to create the BIG.

---
profiles/audio/bap.c | 69 ++++++++++++++++++++++++++++++++++++--------
1 file changed, 57 insertions(+), 12 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 7d7a3ce02..729860fbd 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -916,6 +916,35 @@ static void setup_free(void *data)
free(setup);
}

+static void update_stream(void *data, void *user_data)
+{
+ struct bap_setup *setup = data;
+ struct bap_setup *data_setup = user_data;
+
+ if ((setup->stream != data_setup->stream) &&
+ (setup->qos.bcast.big == data_setup->qos.bcast.big)) {
+
+ if (setup->base)
+ util_iov_free(setup->base, 1);
+
+ setup->base = util_iov_dup(data_setup->base, 1);
+ }
+}
+
+static void update_setup(void *data, void *user_data)
+{
+ struct bap_ep *ep = data;
+ struct bap_setup *setup = user_data;
+
+ queue_foreach(ep->setups, update_stream, setup);
+}
+
+static void update_base(struct bap_setup *setup,
+ struct bap_data *data)
+{
+ queue_foreach(data->bcast, update_setup, setup);
+}
+
static struct bap_ep *ep_register_bcast(struct bap_data *data,
struct bt_bap_pac *lpac,
struct bt_bap_pac *rpac);
@@ -975,6 +1004,10 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
setup->msg = dbus_message_ref(msg);
else {
setup->base = bt_bap_stream_get_base(setup->stream);
+ /* Set the generated BASE on all setups
+ * from the same BIG.
+ */
+ update_base(setup, ep->data);
setup->id = 0;
/* Create a new endpoint for a new BIS */
if (!ep_register_bcast(ep->data, ep->lpac, ep->rpac))
@@ -1847,7 +1880,7 @@ static void setup_connect_io(struct bap_data *data, struct bap_setup *setup,
static void setup_connect_io_broadcast(struct bap_data *data,
struct bap_setup *setup,
struct bt_bap_stream *stream,
- struct bt_iso_qos *qos)
+ struct bt_iso_qos *qos, int defer)
{
struct btd_adapter *adapter = data->user_data;
GIOChannel *io = NULL;
@@ -1884,7 +1917,7 @@ static void setup_connect_io_broadcast(struct bap_data *data,
BT_IO_OPT_MODE, BT_IO_MODE_ISO,
BT_IO_OPT_QOS, qos,
BT_IO_OPT_BASE, &base,
- BT_IO_OPT_DEFER_TIMEOUT, false,
+ BT_IO_OPT_DEFER_TIMEOUT, defer,
BT_IO_OPT_INVALID);

if (!io) {
@@ -2013,9 +2046,6 @@ static void setup_create_bcast_io(struct bap_data *data,

memset(&iso_qos, 0, sizeof(iso_qos));

- if (!defer)
- goto done;
-
iso_qos.bcast.big = setup->qos.bcast.big;
iso_qos.bcast.bis = setup->qos.bcast.bis;
iso_qos.bcast.sync_factor = setup->qos.bcast.sync_factor;
@@ -2032,9 +2062,10 @@ static void setup_create_bcast_io(struct bap_data *data,
iso_qos.bcast.timeout = setup->qos.bcast.timeout;
memcpy(&iso_qos.bcast.out, &setup->qos.bcast.io_qos,
sizeof(struct bt_iso_io_qos));
-done:
+
if (bt_bap_pac_get_type(setup->ep->lpac) == BT_BAP_BCAST_SOURCE)
- setup_connect_io_broadcast(data, setup, stream, &iso_qos);
+ setup_connect_io_broadcast(data, setup, stream, &iso_qos,
+ defer);
else
setup_listen_io_broadcast(data, setup, stream, &iso_qos);
}
@@ -2127,6 +2158,7 @@ static void bap_state_bcast(struct bt_bap_stream *stream, uint8_t old_state,
{
struct bap_data *data = user_data;
struct bap_setup *setup;
+ bool defer = false;

DBG("stream %p: %s(%u) -> %s(%u)", stream,
bt_bap_stream_statestr(old_state), old_state,
@@ -2148,13 +2180,26 @@ static void bap_state_bcast(struct bt_bap_stream *stream, uint8_t old_state,
break;
case BT_BAP_STREAM_STATE_CONFIG:
if (setup && !setup->id) {
- setup_create_io(data, setup, stream, true);
+ /* If the BIG ID was explicitly set, keep creating each
+ * stream io with defer setup until all streams
+ * belonging to the BIG have been configured
+ * (i.e. transport acquire received on appropriate
+ * transport). If the BIG id was left unset, just
+ * create the io without defer, and a BIG with an
+ * arbitrary handle will be created in kernel space.
+ */
+ if (setup->qos.bcast.big != 0xFF)
+ defer = !bt_bap_test_bcast_streams_state(
+ setup->stream,
+ BT_BAP_STREAM_STATE_CONFIG);
+
+ setup_create_io(data, setup, stream, defer);
if (!setup->io) {
error("Unable to create io");
- if (old_state != BT_BAP_STREAM_STATE_RELEASING)
- bt_bap_stream_release(stream, NULL,
- NULL);
- return;
+ if (old_state !=
+ BT_BAP_STREAM_STATE_RELEASING)
+ bt_bap_stream_release(stream,
+ NULL, NULL);
}
}
break;
--
2.39.2


Subject: [PATCH BlueZ 4/7] bap: Split bap_state and bap_connecting in two functions

Split bap_state and bap_connecting in two specific functions
for unicast (bap_state, bap_connecting) and broadcast
(bap_state_bcast, bap_connecting_bcast).

---
profiles/audio/bap.c | 159 +++++++++++++++++++++++++++++--------------
1 file changed, 109 insertions(+), 50 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 9300e98ec..7d7a3ce02 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -2099,25 +2099,19 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state,
return;
}

- if (bt_bap_stream_get_type(stream) ==
- BT_BAP_STREAM_TYPE_UCAST) {
- /* Wait QoS response to respond */
- 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);
- }
+ /* Wait QoS response to respond */
+ 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);
}
}
break;
case BT_BAP_STREAM_STATE_QOS:
- if (bt_bap_stream_get_type(stream) ==
- BT_BAP_STREAM_TYPE_UCAST) {
setup_create_io(data, setup, stream, true);
- }
break;
case BT_BAP_STREAM_STATE_ENABLING:
if (setup)
@@ -2128,6 +2122,45 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state,
}
}

+static void bap_state_bcast(struct bt_bap_stream *stream, uint8_t old_state,
+ uint8_t new_state, void *user_data)
+{
+ struct bap_data *data = user_data;
+ struct bap_setup *setup;
+
+ DBG("stream %p: %s(%u) -> %s(%u)", stream,
+ bt_bap_stream_statestr(old_state), old_state,
+ bt_bap_stream_statestr(new_state), new_state);
+
+ /* Ignore transitions back to same state */
+ if (new_state == old_state)
+ return;
+
+ setup = bap_find_setup_by_stream(data, stream);
+
+ switch (new_state) {
+ case BT_BAP_STREAM_STATE_IDLE:
+ /* Release stream if idle */
+ if (setup)
+ setup_free(setup);
+ else
+ queue_remove(data->streams, stream);
+ break;
+ case BT_BAP_STREAM_STATE_CONFIG:
+ if (setup && !setup->id) {
+ setup_create_io(data, setup, stream, true);
+ if (!setup->io) {
+ error("Unable to create io");
+ if (old_state != BT_BAP_STREAM_STATE_RELEASING)
+ bt_bap_stream_release(stream, NULL,
+ NULL);
+ return;
+ }
+ }
+ break;
+ }
+}
+
static void pac_added(struct bt_bap_pac *pac, void *user_data)
{
struct btd_service *service = user_data;
@@ -2321,45 +2354,71 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd,

g_io_channel_set_close_on_unref(io, FALSE);

- switch (bt_bap_stream_get_type(setup->stream)) {
- case BT_BAP_STREAM_TYPE_UCAST:
- /* Attempt to get CIG/CIS if they have not been set */
- if (qos->ucast.cig_id == BT_ISO_QOS_CIG_UNSET ||
- qos->ucast.cis_id == BT_ISO_QOS_CIS_UNSET) {
- struct bt_iso_qos iso_qos;
+ /* Attempt to get CIG/CIS if they have not been set */
+ if (qos->ucast.cig_id == BT_ISO_QOS_CIG_UNSET ||
+ qos->ucast.cis_id == BT_ISO_QOS_CIS_UNSET) {
+ struct bt_iso_qos iso_qos;

- if (!io_get_qos(io, &iso_qos)) {
- g_io_channel_unref(io);
- return;
- }
-
- qos->ucast.cig_id = iso_qos.ucast.cig;
- qos->ucast.cis_id = iso_qos.ucast.cis;
+ if (!io_get_qos(io, &iso_qos)) {
+ g_io_channel_unref(io);
+ return;
}

- DBG("stream %p fd %d: CIG 0x%02x CIS 0x%02x", stream, fd,
- qos->ucast.cig_id, qos->ucast.cis_id);
- break;
- case BT_BAP_STREAM_TYPE_BCAST:
- /* Attempt to get BIG/BIS if they have not been set */
- if (setup->qos.bcast.big == BT_ISO_QOS_BIG_UNSET ||
- setup->qos.bcast.bis == BT_ISO_QOS_BIS_UNSET) {
- struct bt_iso_qos iso_qos;
+ qos->ucast.cig_id = iso_qos.ucast.cig;
+ qos->ucast.cis_id = iso_qos.ucast.cis;
+ }

- if (!io_get_qos(io, &iso_qos)) {
- g_io_channel_unref(io);
- return;
- }
+ DBG("stream %p fd %d: CIG 0x%02x CIS 0x%02x", stream, fd,
+ qos->ucast.cig_id, qos->ucast.cis_id);
+}
+
+static void bap_connecting_bcast(struct bt_bap_stream *stream, bool state,
+ int fd, void *user_data)
+{
+ struct bap_data *data = user_data;
+ struct bap_setup *setup;
+ struct bt_bap_qos *qos;
+ GIOChannel *io;
+
+ if (!state)
+ return;
+
+ setup = bap_find_setup_by_stream(data, stream);
+ if (!setup)
+ return;
+
+ setup->recreate = false;
+ qos = &setup->qos;
+
+ if (!setup->io) {
+ io = g_io_channel_unix_new(fd);
+ setup->io_id = g_io_add_watch(io,
+ G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ setup_io_disconnected, setup);
+ setup->io = io;
+ } else
+ io = setup->io;
+
+ g_io_channel_set_close_on_unref(io, FALSE);
+
+ /* Attempt to get BIG/BIS if they have not been set */
+ if (setup->qos.bcast.big == BT_ISO_QOS_BIG_UNSET ||
+ setup->qos.bcast.bis == BT_ISO_QOS_BIS_UNSET) {
+ struct bt_iso_qos iso_qos;

- qos->bcast.big = iso_qos.bcast.big;
- qos->bcast.bis = iso_qos.bcast.bis;
- bt_bap_stream_config(setup->stream, qos, setup->caps,
- NULL, NULL);
+ if (!io_get_qos(io, &iso_qos)) {
+ g_io_channel_unref(io);
+ return;
}

- DBG("stream %p fd %d: BIG 0x%02x BIS 0x%02x", stream, fd,
- qos->bcast.big, qos->bcast.bis);
+ qos->bcast.big = iso_qos.bcast.big;
+ qos->bcast.bis = iso_qos.bcast.bis;
+ bt_bap_stream_config(setup->stream, qos, setup->caps,
+ NULL, NULL);
}
+
+ DBG("stream %p fd %d: BIG 0x%02x BIS 0x%02x", stream, fd,
+ qos->bcast.big, qos->bcast.bis);
}

static void bap_attached(struct bt_bap *bap, void *user_data)
@@ -2452,10 +2511,10 @@ static int bap_bcast_probe(struct btd_service *service)

data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service,
NULL);
- data->state_id = bt_bap_state_register(data->bap, bap_state,
- bap_connecting, data, NULL);
+ data->state_id = bt_bap_state_register(data->bap, bap_state_bcast,
+ bap_connecting_bcast, data, NULL);
data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast,
- pac_removed_broadcast, data, NULL);
+ pac_removed_broadcast, data, NULL);

bt_bap_set_user_data(data->bap, service);

@@ -2607,8 +2666,8 @@ static int bap_adapter_probe(struct btd_profile *p,
return -EINVAL;
}

- data->state_id = bt_bap_state_register(data->bap, bap_state,
- bap_connecting, data, NULL);
+ data->state_id = bt_bap_state_register(data->bap, bap_state_bcast,
+ bap_connecting_bcast, data, NULL);
data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast,
pac_removed_broadcast, data, NULL);

--
2.39.2


Subject: [PATCH BlueZ 5/7] shared/bap: Check the state of all the streams with the same BIG ID

Add a function to check the state of all the streams with the same BIG ID

---
src/shared/bap.c | 26 ++++++++++++++++++++++++++
src/shared/bap.h | 2 ++
2 files changed, 28 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index a4c6a1bcd..244bd8c4e 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5884,3 +5884,29 @@ struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream)

return base_iov;
}
+
+/*
+ * Check the state of all streams with the same BIG ID.
+ * If all these streams are in the checked state, return true.
+ * Else, return false.
+ */
+bool bt_bap_test_bcast_streams_state(struct bt_bap_stream *stream,
+ uint8_t test_state)
+{
+ const struct queue_entry *entry;
+ struct bt_bap_stream *e_str;
+
+ for (entry = queue_get_entries(stream->bap->streams);
+ entry; entry = entry->next) {
+ e_str = entry->data;
+
+ if ((e_str == stream) ||
+ (e_str->qos.bcast.big != stream->qos.bcast.big))
+ continue;
+
+ if (e_str->ep->state != test_state)
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 2c3550921..9d46c5ad4 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -323,3 +323,5 @@ void bt_bap_update_bcast_source(struct bt_bap_pac *pac,
bool bt_bap_pac_bcast_is_local(struct bt_bap *bap, struct bt_bap_pac *pac);

struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream);
+bool bt_bap_test_bcast_streams_state(struct bt_bap_stream *stream,
+ uint8_t test_state);
--
2.39.2


Subject: [PATCH BlueZ 7/7] shared/bap: Generate single BIS BASE for a configuration with BIG ID 0xFF

If the BIG ID was explicitly set, create a BASE with information
from all streams belonging to this BIG. Otherwise, create a BASE
with only this BIS.

---
src/shared/bap.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 244bd8c4e..c144d4b3b 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5872,11 +5872,16 @@ struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream)
base.next_bis_index = 1;
base.big_id = stream->qos.bcast.big;

- /*
- * Create subgroups with each different Metadata and Codec
- * Specific Configuration from all streams having the same BIG ID.
+ /* If the BIG ID was explicitly set, create a BASE with information
+ * from all streams belonging to this BIG. Otherwise, create a BASE
+ * with only this BIS.
*/
- queue_foreach(stream->bap->streams, set_base_subgroup, &base);
+ if (stream->qos.bcast.big != 0xFF)
+ queue_foreach(stream->bap->streams, set_base_subgroup, &base);
+ else {
+ base.pres_delay = stream->qos.bcast.delay;
+ set_base_subgroup(stream, &base);
+ }

base_iov = generate_base(&base);

--
2.39.2


2024-02-01 15:46:40

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 0/7] Add support for multiple BISes on the bcast source

Hi Silviu,

On Thu, Feb 1, 2024 at 10:28 AM Silviu Florian Barbulescu
<[email protected]> wrote:
>
> This patch adds support for multiple BISes in broadcast sources.
>
> Example commands:
> Create a local endpoint and an endpoint for BIS1:
> endpoint.register 00001852-0000-1000-8000-00805f9b34fb 0x06
> [/local/endpoint/ep0] Auto Accept (yes/no): y
> [/local/endpoint/ep0] Max Transports (auto/value): a
> [/local/endpoint/ep0] Locations: 0x03
> [/local/endpoint/ep0] Supported Context (value): 0
>
> Configure BIS1, create BIS1 transport and endpoint for BIS2:
> endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 48_4_1
> [/local/endpoint/ep0] BIG (auto/value): 0x01
> [/local/endpoint/ep0] Enter channel location (value/no): 0x01
> [/local/endpoint/ep0] Enter Metadata (value/no): n
>
> Configure BIS2, create BIS2 transport and endpoint for BIS3:
> endpoint.config /org/bluez/hci0/pac_bcast1 /local/endpoint/ep0 48_4_1
> [/local/endpoint/ep0] BIG (auto/value): 0x01
> [/local/endpoint/ep0] Enter channel location (value/no): 0x02
> [/local/endpoint/ep0] Enter Metadata (value/no): n
>
> For multiple BISes acquire must be called on all transports
> before the BIG is created:
> transport.acquire /org/bluez/hci0/pac_bcast0/fd0
> transport.acquire /org/bluez/hci0/pac_bcast1/fd1
> .....
> transport.release /org/bluez/hci0/pac_bcast0/fd0
> transport.release /org/bluez/hci0/pac_bcast1/fd1
>
> Silviu Florian Barbulescu (7):
> bap: Remove set lpac user data at bcast ep register
> shared/bap: Add support to create multiple streams for the same pac
> bap: Create a new endpoint to be available for the next BIS
> configuration
> bap: Split bap_state and bap_connecting in two functions
> shared/bap: Check the state of all the streams with the same BIG ID
> bap: Set the generated BASE on all setups from the same BIG
> shared/bap: Generate single BIS BASE for a configuration with BIG ID
> 0xFF
>
> profiles/audio/bap.c | 239 ++++++++++++++++++++++++++++++++-----------
> src/shared/bap.c | 67 ++++++++++--
> src/shared/bap.h | 2 +
> 3 files changed, 238 insertions(+), 70 deletions(-)
>
>
> base-commit: a692cc44dc8735b9303f8893f784306b4d2654fe
> --
> 2.39.2

Not sure how you guys are testing these changes but currently I can't
get Broadcast Sink to work, and it crashes on the the cleanup:

https://gist.github.com/Vudentz/00a62914b0dc08261065cea65c0e04f0

So until we fix that I'm actually not merging new code on top, I'm
also considering moving the driver out of bap plugin and perhaps have
it as a standalone bcaa plugin since there have been quite a few
occasions where broadcast code has caused regressions on unicast.

Anyway Ive been working on the following fixes and I do appreciate
some feedback:

https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/
https://patchwork.kernel.org/project/bluetooth/list/?series=822175

--
Luiz Augusto von Dentz

2024-02-01 17:38:18

by bluez.test.bot

[permalink] [raw]
Subject: RE: Add support for multiple BISes on the bcast source

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=822172

---Test result---

Test Summary:
CheckPatch PASS 3.34 seconds
GitLint FAIL 2.43 seconds
BuildEll PASS 24.07 seconds
BluezMake PASS 724.99 seconds
MakeCheck PASS 11.65 seconds
MakeDistcheck PASS 164.10 seconds
CheckValgrind PASS 227.51 seconds
CheckSmatch PASS 329.70 seconds
bluezmakeextell PASS 107.31 seconds
IncrementalBuild PASS 4692.55 seconds
ScanBuild PASS 942.52 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,3/7] bap: Create a new endpoint to be available for the next BIS configuration

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (85>80): "[BlueZ,3/7] bap: Create a new endpoint to be available for the next BIS configuration"
[BlueZ,7/7] shared/bap: Generate single BIS BASE for a configuration with BIG ID 0xFF

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (85>80): "[BlueZ,7/7] shared/bap: Generate single BIS BASE for a configuration with BIG ID 0xFF"


---
Regards,
Linux Bluetooth