Subject: [PATCH BlueZ v4 0/5] 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_bcast0 /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_bcast0/fd1
.....
transport.release /org/bluez/hci0/pac_bcast0/fd0
transport.release /org/bluez/hci0/pac_bcast0/fd1

Silviu Florian Barbulescu (5):
shared/bap: Fix endpoint direction for the broadcast source
shared/bap: Add state in the stream struct for broadcast source
shared/bap: Add support to create a stream for broadcast source
bap: Add a callback to create a new stream
bap: Set the generated BASE on all setups from the same BIG

profiles/audio/bap.c | 223 +++++++++++++++++++++++++++++++++++++++----
src/shared/bap.c | 133 ++++++++++++++++++++++----
src/shared/bap.h | 6 ++
3 files changed, 327 insertions(+), 35 deletions(-)


base-commit: 8f262a27bdf233f142a7bb22bf3f8c6db53debee
--
2.39.2



Subject: [PATCH BlueZ v4 1/5] shared/bap: Fix endpoint dir for the bcast source

Fix endpoint direction for the broadcast source

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

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 626e8f127..fd29557b1 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -682,7 +682,7 @@ static struct bt_bap_endpoint *bap_endpoint_new_broadcast(struct bt_bap_db *bdb,
if (type == BT_BAP_BCAST_SINK)
ep->dir = BT_BAP_BCAST_SOURCE;
else
- ep->dir = 0;
+ ep->dir = BT_BAP_BCAST_SINK;

return ep;
}
@@ -1303,7 +1303,7 @@ static void ep_config_cb(struct bt_bap_stream *stream, int err)
return;

if (bt_bap_stream_get_type(stream) == BT_BAP_STREAM_TYPE_BCAST) {
- if (!bt_bap_stream_io_dir(stream))
+ if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK)
stream_set_state(stream, BT_BAP_STREAM_STATE_QOS);
else if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE)
stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
--
2.39.2


Subject: [PATCH BlueZ v4 2/5] shared/bap: Add state in stream struct for bcast source

Add state support in the stream struct for broadcast source.
---
src/shared/bap.c | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index fd29557b1..0a336fc01 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -251,6 +251,8 @@ struct bt_bap_stream {
struct bt_bap_stream *link;
struct bt_bap_stream_io *io;
const struct bt_bap_stream_ops *ops;
+ uint8_t old_state;
+ uint8_t state;
bool client;
void *user_data;
};
@@ -1271,7 +1273,6 @@ static void bap_stream_state_changed(struct bt_bap_stream *stream)

static void stream_set_state(struct bt_bap_stream *stream, uint8_t state)
{
- struct bt_bap_endpoint *ep = stream->ep;
struct bt_bap *bap = stream->bap;

/* Check if ref_count is already 0 which means detaching is in
@@ -1283,14 +1284,6 @@ static void stream_set_state(struct bt_bap_stream *stream, uint8_t state)
return;
}

- ep->old_state = ep->state;
- ep->state = state;
-
- DBG(bap, "stream %p dir 0x%02x: %s -> %s", stream,
- bt_bap_stream_get_dir(stream),
- bt_bap_stream_statestr(stream->ep->old_state),
- bt_bap_stream_statestr(stream->ep->state));
-
if (stream->ops && stream->ops->set_state)
stream->ops->set_state(stream, state);

@@ -1527,6 +1520,14 @@ static void bap_ucast_set_state(struct bt_bap_stream *stream, uint8_t state)
{
struct bt_bap_endpoint *ep = stream->ep;

+ ep->old_state = ep->state;
+ ep->state = state;
+
+ DBG(stream->bap, "stream %p dir 0x%02x: %s -> %s", stream,
+ bt_bap_stream_get_dir(stream),
+ bt_bap_stream_statestr(stream->ep->old_state),
+ bt_bap_stream_statestr(stream->ep->state));
+
if (stream->lpac->type == BT_BAP_BCAST_SINK || stream->client)
goto done;

@@ -1942,22 +1943,25 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state)
struct bt_bap *bap = stream->bap;
const struct queue_entry *entry;

+ stream->old_state = stream->state;
+ stream->state = state;
+
DBG(bap, "stream %p dir 0x%02x: %s -> %s", stream,
bt_bap_stream_get_dir(stream),
- bt_bap_stream_statestr(stream->ep->old_state),
- bt_bap_stream_statestr(stream->ep->state));
+ bt_bap_stream_statestr(stream->old_state),
+ bt_bap_stream_statestr(stream->state));

for (entry = queue_get_entries(bap->state_cbs); entry;
entry = entry->next) {
struct bt_bap_state *state = entry->data;

if (state->func)
- state->func(stream, stream->ep->old_state,
- stream->ep->state, state->data);
+ state->func(stream, stream->old_state,
+ stream->state, state->data);
}

/* Post notification updates */
- switch (stream->ep->state) {
+ switch (stream->state) {
case BT_ASCS_ASE_STATE_IDLE:
bap_stream_detach(stream);
break;
@@ -5243,7 +5247,10 @@ uint8_t bt_bap_stream_get_state(struct bt_bap_stream *stream)
if (!stream)
return BT_BAP_STREAM_STATE_IDLE;

- return stream->ep->state;
+ if (stream->lpac->type != BT_BAP_BCAST_SOURCE)
+ return stream->ep->state;
+ else
+ return stream->state;
}

bool bt_bap_stream_set_user_data(struct bt_bap_stream *stream, void *user_data)
--
2.39.2


Subject: [PATCH BlueZ v4 3/5] shared/bap: Add support to create a stream for bcast src

Split bt_bap_stream_new and two specific functions for
unicast and broadcast.
Add a function to find an remote endpoint for broadcast source.
---
src/shared/bap.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++
src/shared/bap.h | 6 ++++
2 files changed, 98 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 0a336fc01..0931c8fa2 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5043,6 +5043,16 @@ static bool find_ep_pacs(const void *data, const void *user_data)
return false;
}

+static bool find_ep_source(const void *data, const void *user_data)
+{
+ const struct bt_bap_endpoint *ep = data;
+
+ if (ep->dir == BT_BAP_BCAST_SINK)
+ return true;
+ else
+ return false;
+}
+
unsigned int bt_bap_stream_config(struct bt_bap_stream *stream,
struct bt_bap_qos *qos,
struct iovec *data,
@@ -5153,6 +5163,88 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
return 0;
}

+struct bt_bap_stream *bt_bap_stream_bcast_new(struct bt_bap *bap,
+ struct bt_bap_pac *lpac,
+ struct bt_bap_pac *rpac,
+ struct bt_bap_qos *pqos,
+ struct iovec *data)
+{
+ struct bt_bap_stream *stream = NULL;
+ struct bt_bap_endpoint *ep = NULL;
+ struct match_pac match;
+
+ if (!bap)
+ return NULL;
+
+ if (!rpac && (lpac->type != BT_BAP_BCAST_SOURCE)
+ && queue_isempty(bap->remote_eps))
+ return NULL;
+
+ if (lpac && rpac) {
+ if ((rpac->type != BT_BAP_BCAST_SOURCE)
+ && (!bap_codec_equal(&lpac->codec, &rpac->codec)))
+ return NULL;
+ } else {
+ uint8_t type;
+
+ match.lpac = lpac;
+ match.rpac = rpac;
+ memset(&match.codec, 0, sizeof(match.codec));
+
+ if (rpac)
+ type = rpac->type;
+ else if (lpac) {
+ switch (lpac->type) {
+ case BT_BAP_BCAST_SOURCE:
+ type = BT_BAP_BCAST_SINK;
+ break;
+ case BT_BAP_BCAST_SINK:
+ type = BT_BAP_BCAST_SOURCE;
+ break;
+ default:
+ return NULL;
+ }
+ } else
+ return NULL;
+
+ bt_bap_foreach_pac(bap, type, match_pac, &match);
+ if ((!match.lpac) || (!lpac))
+ return NULL;
+ if (!match.rpac && (lpac->type != BT_BAP_BCAST_SOURCE))
+ return NULL;
+
+ lpac = match.lpac;
+ rpac = match.rpac;
+ }
+
+ match.lpac = lpac;
+ match.rpac = rpac;
+
+ 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) {
+ DBG(bap, "Unable to find unused ASE");
+ return NULL;
+ }
+ }
+ stream = ep->stream;
+ } else {
+ ep = queue_find(bap->remote_eps, find_ep_source, NULL);
+ if (!ep)
+ return NULL;
+ }
+
+ if (!stream)
+ stream = bap_stream_new(bap, ep, lpac, rpac, data, true);
+
+ return stream;
+}
+
struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
struct bt_bap_pac *lpac,
struct bt_bap_pac *rpac,
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 2c3550921..fa0d4b524 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -244,6 +244,12 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
struct bt_bap_qos *pqos,
struct iovec *data);

+struct bt_bap_stream *bt_bap_stream_bcast_new(struct bt_bap *bap,
+ struct bt_bap_pac *lpac,
+ struct bt_bap_pac *rpac,
+ struct bt_bap_qos *pqos,
+ struct iovec *data);
+
struct bt_bap *bt_bap_stream_get_session(struct bt_bap_stream *stream);
uint8_t bt_bap_stream_get_state(struct bt_bap_stream *stream);

--
2.39.2


Subject: [PATCH BlueZ v4 4/5] bap: Add a callback to create a new stream

Add a callback to create a new stream

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

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index b4acdd9ef..2c7daa6d4 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -68,6 +68,11 @@ struct bap_setup {
struct bt_bap_qos qos;
int (*qos_parser)(struct bap_setup *setup, const char *key, int var,
DBusMessageIter *iter);
+ struct bt_bap_stream* (*stream_new)(struct bt_bap *bap,
+ struct bt_bap_pac *lpac,
+ struct bt_bap_pac *rpac,
+ struct bt_bap_qos *pqos,
+ struct iovec *data);
GIOChannel *io;
unsigned int io_id;
bool recreate;
@@ -888,11 +893,13 @@ static struct bap_setup *setup_new(struct bap_ep *ep)
setup->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET;
setup->qos_parser = setup_parse_bcast_qos;
setup->destroy = setup_bcast_destroy;
+ setup->stream_new = bt_bap_stream_bcast_new;
} else {
/* Mark CIG and CIS to be auto assigned */
setup->qos.ucast.cig_id = BT_ISO_QOS_CIG_UNSET;
setup->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
setup->qos_parser = setup_parse_ucast_qos;
+ setup->stream_new = bt_bap_stream_new;
}

if (!ep->setups)
@@ -954,7 +961,7 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
return btd_error_invalid_args(msg);
}

- setup->stream = bt_bap_stream_new(ep->data->bap, ep->lpac, ep->rpac,
+ setup->stream = setup->stream_new(ep->data->bap, ep->lpac, ep->rpac,
&setup->qos, setup->caps);

setup->id = bt_bap_stream_config(setup->stream, &setup->qos,
@@ -1290,7 +1297,7 @@ static void setup_config(void *data, void *user_data)
* and PHY.
*/
if (!setup->stream)
- setup->stream = bt_bap_stream_new(ep->data->bap, ep->lpac,
+ setup->stream = setup->stream_new(ep->data->bap, ep->lpac,
ep->rpac, &setup->qos,
setup->caps);

--
2.39.2


Subject: [PATCH BlueZ v4 5/5] bap: Set 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 | 212 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 196 insertions(+), 16 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 2c7daa6d4..38577bcf3 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -950,8 +950,12 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
if (dbus_message_iter_get_arg_type(&props) != DBUS_TYPE_DICT_ENTRY)
return btd_error_invalid_args(msg);

- /* Disconnect IOs if connecting since QoS is going to be reconfigured */
- ep_close(ep);
+ /* Broadcast source supports multiple setups, each setup will be BIS
+ * and will be configured with the set_configuration command
+ * TO DO reconfiguration of a BIS.
+ */
+ if (bt_bap_pac_get_type(ep->lpac) != BT_BAP_BCAST_SOURCE)
+ ep_close(ep);

setup = setup_new(ep);

@@ -987,7 +991,6 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SINK)
setup->msg = dbus_message_ref(msg);
else {
- setup->base = bt_bap_stream_get_base(setup->stream);
setup->id = 0;
}

@@ -1853,7 +1856,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;
@@ -1890,7 +1893,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) {
@@ -2019,9 +2022,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;
@@ -2038,9 +2038,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);
}
@@ -2128,11 +2129,135 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state,
}
}

+/* This function will call setup_create_io on all BISes from a BIG.
+ * The defer parameter will be set on true on all but the last one.
+ * This is done to inform the kernel when to when to start the BIG.
+ */
+static bool create_io_bises(struct bap_setup *setup,
+ uint8_t nb_bises, struct bap_data *data)
+{
+ const struct queue_entry *entry;
+ struct bap_setup *ent_setup;
+ bool defer = true;
+ uint8_t active_bis_cnt = 1;
+
+ for (entry = queue_get_entries(setup->ep->setups);
+ entry; entry = entry->next) {
+ ent_setup = entry->data;
+
+ if (bt_bap_stream_get_qos(ent_setup->stream)->bcast.big !=
+ bt_bap_stream_get_qos(setup->stream)->bcast.big)
+ continue;
+
+ if (active_bis_cnt == nb_bises)
+ defer = false;
+
+ setup_create_io(data, ent_setup, ent_setup->stream, defer);
+ if (!ent_setup->io) {
+ error("Unable to create io");
+ goto fail;
+ }
+
+ active_bis_cnt++;
+ }
+
+ return true;
+
+fail:
+ /* Clear the io of the created sockets if one
+ * socket creation fails.
+ */
+ for (entry = queue_get_entries(setup->ep->setups);
+ entry; entry = entry->next) {
+ ent_setup = entry->data;
+
+ if (bt_bap_stream_get_qos(ent_setup->stream)->bcast.big !=
+ bt_bap_stream_get_qos(setup->stream)->bcast.big)
+ continue;
+
+ if (setup->io)
+ g_io_channel_unref(setup->io);
+ }
+ return false;
+}
+
+static void iterate_setup_update_base(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);
+ }
+}
+
+/* Function checks the state of all streams in the same BIG
+ * as the parameter stream, so it can decide if any sockets need
+ * to be created. Returns he number of streams that need a socket
+ * from that BIG.
+ */
+static uint8_t get_streams_nb_by_state(struct bap_setup *setup)
+{
+ const struct queue_entry *entry;
+ struct bap_setup *ent_setup;
+ uint8_t stream_cnt = 0;
+
+ if (setup->qos.bcast.big == BT_ISO_QOS_BIG_UNSET)
+ /* If BIG ID is unset this is a single BIS BIG.
+ * return 1 as create one socket only for this BIS
+ */
+ return 1;
+
+ for (entry = queue_get_entries(setup->ep->setups);
+ entry; entry = entry->next) {
+ ent_setup = entry->data;
+
+ /* Skip the curent stream form testing */
+ if (ent_setup == setup) {
+ stream_cnt++;
+ continue;
+ }
+
+ /* Test only BISes for the same BIG */
+ if (bt_bap_stream_get_qos(ent_setup->stream)->bcast.big !=
+ bt_bap_stream_get_qos(setup->stream)->bcast.big)
+ continue;
+
+ if (bt_bap_stream_get_state(ent_setup->stream) ==
+ BT_BAP_STREAM_STATE_STREAMING)
+ /* If one stream in a multiple BIS BIG is in
+ * streaming state this means that just the current
+ * stream must have is socket created so return 1.
+ */
+ return 1;
+ else if (bt_bap_stream_get_state(ent_setup->stream) !=
+ BT_BAP_STREAM_STATE_CONFIG)
+ /* Not all streams form a BIG have received transport
+ * acquire, so wait for the other streams to.
+ */
+ return 0;
+
+ stream_cnt++;
+ }
+
+ /* Return the number of streams for the BIG
+ * as all are ready to create sockets
+ */
+ return stream_cnt;
+}
+
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;
+ bool defer = false;
+ uint8_t nb_bises = 0;

DBG("stream %p: %s(%u) -> %s(%u)", stream,
bt_bap_stream_statestr(old_state), old_state,
@@ -2153,14 +2278,69 @@ static void bap_state_bcast(struct bt_bap_stream *stream, uint8_t old_state,
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 || setup->id)
+ break;
+ if (bt_bap_stream_io_dir(stream) ==
+ BT_BAP_BCAST_SOURCE) {
+ /* If the stream is attached to a
+ * broadcast sink endpoint.
+ */
+ 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);
+ }
+ } else {
+ /* If the stream attached to a broadcast
+ * source endpoint generate the base.
+ */
+ if (setup->base == NULL) {
+ setup->base = bt_bap_stream_get_base(
+ setup->stream);
+ /* Set the generated BASE on all setups
+ * from the same BIG.
+ */
+ queue_foreach(setup->ep->setups,
+ iterate_setup_update_base, setup);
+ }
+ /* The kernel has 2 requirements when handling
+ * multiple BIS connections for the same BIG:
+ * 1 - setup_create_io for all but the last BIS
+ * must be with defer true so we can inform the
+ * kernel when to start the BIG.
+ * 2 - The order in which the setup_create_io
+ * are called must be in the order of BIS
+ * indexes in BASE from first to last.
+ * To address this requirement we will call
+ * setup_create_io on all BISes only when all
+ * transport acquire have been received and will
+ * send it in the order of the BIS index
+ * from BASE.
+ */
+ nb_bises = get_streams_nb_by_state(setup);
+
+ if (nb_bises == 1) {
+ 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);
+ }
+ break;
+ } else if (nb_bises == 0)
+ break;
+
+ if (!create_io_bises(setup, nb_bises, data)) {
+ if (old_state !=
+ BT_BAP_STREAM_STATE_RELEASING)
+ bt_bap_stream_release(stream,
+ NULL, NULL);
}
}
break;
--
2.39.2


2024-02-23 18:51:58

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

---Test result---

Test Summary:
CheckPatch PASS 2.21 seconds
GitLint PASS 1.39 seconds
BuildEll PASS 24.08 seconds
BluezMake PASS 730.41 seconds
MakeCheck PASS 11.71 seconds
MakeDistcheck PASS 163.60 seconds
CheckValgrind PASS 226.46 seconds
CheckSmatch PASS 330.87 seconds
bluezmakeextell PASS 107.61 seconds
IncrementalBuild PASS 3404.27 seconds
ScanBuild WARNING 946.94 seconds

Details
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
src/shared/bap.c:1147:2: warning: Use of memory after it is freed
DBG(stream->bap, "stream %p", stream);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/bap.c:40:2: note: expanded from macro 'DBG'
bap_debug(_bap, "%s:%s() " fmt, __FILE__, __func__, ## arg)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/bap.c:1281:8: warning: Use of memory after it is freed
bap = bt_bap_ref_safe(bap);
^~~~~~~~~~~~~~~~~~~~
src/shared/bap.c:1699:3: warning: Use of memory after it is freed
stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.



---
Regards,
Linux Bluetooth

2024-02-27 14:57:08

by patchwork-bot+bluetooth

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

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Fri, 23 Feb 2024 18:48:08 +0200 you 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
>
> [...]

Here is the summary with links:
- [BlueZ,v4,1/5] shared/bap: Fix endpoint dir for the bcast source
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8552e06b6617
- [BlueZ,v4,2/5] shared/bap: Add state in stream struct for bcast source
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b4f9a9fd7ed2
- [BlueZ,v4,3/5] shared/bap: Add support to create a stream for bcast src
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6ea7f481094c
- [BlueZ,v4,4/5] bap: Add a callback to create a new stream
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=dd57562760e4
- [BlueZ,v4,5/5] bap: Set generated BASE on all setups from the same BIG
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=92f3ed187904

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html