Subject: [PATCH v3 0/2] Update transport acquire/release flow BAP bcast source

Update transport acquire/release flow for BAP broadcast source to
fix failure on transport release, and second acquire

Silviu Florian Barbulescu (2):
transport: Update transport release flow for broadcast source
bap:Update transport acquire/release flow for bcast source

profiles/audio/bap.c | 51 ++++++++++++++++++++++++++----
profiles/audio/transport.c | 65 ++++++++++++++++++++++----------------
2 files changed, 82 insertions(+), 34 deletions(-)


base-commit: 7a79ff88fd9576cd9935a8c0bab4906b7c38ea03
--
2.39.2


Subject: [PATCH v3 2/2] bap:Update transport acquire/release flow for bcast src

Update transport acquire/release flow for BAP bcast source

---
profiles/audio/bap.c | 51 ++++++++++++++++++++++++++++++++++++++------
1 file changed, 44 insertions(+), 7 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 48a1a4f86..f23e04f00 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1312,6 +1312,32 @@ static struct bap_ep *bap_find_ep_by_stream(struct bap_data *data,
return NULL;
}

+static void iso_connect_bcast_cb(GIOChannel *chan, GError *err,
+ gpointer user_data)
+{
+ struct bt_bap_stream *stream = user_data;
+ int fd;
+
+ if (err) {
+ error("%s", err->message);
+ bt_bap_stream_set_io(stream, -1);
+ return;
+ }
+
+ DBG("ISO connected");
+
+ fd = g_io_channel_unix_get_fd(chan);
+
+ if (bt_bap_stream_set_io(stream, fd)) {
+ bt_bap_stream_start(stream, NULL, NULL);
+ g_io_channel_set_close_on_unref(chan, FALSE);
+ return;
+ }
+
+ error("Unable to set IO");
+ bt_bap_stream_set_io(stream, -1);
+}
+
static void iso_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
{
struct bt_bap_stream *stream = user_data;
@@ -1560,6 +1586,17 @@ static gboolean bap_io_disconnected(GIOChannel *io, GIOCondition cond,
return FALSE;
}

+static void bap_connect_bcast_io_cb(GIOChannel *chan, GError *err,
+ gpointer user_data)
+{
+ struct bap_ep *ep = user_data;
+
+ if (!ep->stream)
+ return;
+
+ iso_connect_bcast_cb(chan, err, ep->stream);
+}
+
static void bap_connect_io_cb(GIOChannel *chan, GError *err, gpointer user_data)
{
struct bap_ep *ep = user_data;
@@ -1661,7 +1698,7 @@ static void bap_connect_io_broadcast(struct bap_data *data, struct bap_ep *ep,
DBG("ep %p stream %p ", ep, stream);
ba2str(btd_adapter_get_address(adapter), addr);

- io = bt_io_connect(bap_connect_io_cb, ep, NULL, &err,
+ io = bt_io_connect(bap_connect_bcast_io_cb, ep, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
btd_adapter_get_address(adapter),
BT_IO_OPT_DEST_BDADDR,
@@ -1887,18 +1924,16 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state,
}
break;
case BT_BAP_STREAM_STATE_QOS:
- bap_create_io(data, ep, stream, true);
+ if (bt_bap_stream_get_type(stream) ==
+ BT_BAP_STREAM_TYPE_UCAST) {
+ bap_create_io(data, ep, stream, true);
+ }
break;
case BT_BAP_STREAM_STATE_ENABLING:
if (ep)
bap_create_io(data, ep, stream, false);
break;
case BT_BAP_STREAM_STATE_STREAMING:
- if (bt_bap_stream_get_type(stream) ==
- BT_BAP_STREAM_TYPE_BCAST) {
- if (ep)
- bap_create_io(data, ep, stream, false);
- }
break;
}
}
@@ -2116,6 +2151,8 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd,

ep->qos.bcast.big = qos.bcast.big;
ep->qos.bcast.bis = qos.bcast.bis;
+ bt_bap_stream_config(ep->stream, &ep->qos,
+ ep->caps, NULL, NULL);
}

DBG("stream %p fd %d: BIG 0x%02x BIS 0x%02x", stream, fd,
--
2.39.2

Subject: [PATCH v3 1/2] transport: Update transport release flow for bcast src

Update transport release flow for broadcast source

---
profiles/audio/transport.c | 65 ++++++++++++++++++++++----------------
1 file changed, 38 insertions(+), 27 deletions(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 1e03b7b51..23ea267f6 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -606,11 +606,38 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
return NULL;
}

+static void bap_stop_complete(struct bt_bap_stream *stream,
+ uint8_t code, uint8_t reason,
+ void *user_data)
+{
+ struct media_owner *owner = user_data;
+ struct media_request *req = owner->pending;
+ struct media_transport *transport = owner->transport;
+
+ /* Release always succeeds */
+ if (req) {
+ req->id = 0;
+ media_request_reply(req, 0);
+ media_owner_remove(owner);
+ }
+
+ transport_set_state(transport, TRANSPORT_STATE_IDLE);
+ media_transport_remove_owner(transport);
+}
+
+static void bap_disable_complete(struct bt_bap_stream *stream,
+ uint8_t code, uint8_t reason,
+ void *user_data)
+{
+ bap_stop_complete(stream, code, reason, user_data);
+}
+
static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
void *data)
{
struct media_transport *transport = data;
struct media_owner *owner = transport->owner;
+ struct bap_transport *bap = transport->data;
const char *sender;
struct media_request *req;
guint id;
@@ -642,6 +669,11 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
req = media_request_create(msg, id);
media_owner_add(owner, req);

+ if (bt_bap_stream_get_type(bap->stream) ==
+ BT_BAP_STREAM_TYPE_BCAST) {
+ bap_disable_complete(bap->stream, 0x00, 0x00, owner);
+ }
+
return NULL;
}

@@ -1370,32 +1402,6 @@ static guint resume_bap(struct media_transport *transport,
return id;
}

-static void bap_stop_complete(struct bt_bap_stream *stream,
- uint8_t code, uint8_t reason,
- void *user_data)
-{
- struct media_owner *owner = user_data;
- struct media_request *req = owner->pending;
- struct media_transport *transport = owner->transport;
-
- /* Release always succeeds */
- if (req) {
- req->id = 0;
- media_request_reply(req, 0);
- media_owner_remove(owner);
- }
-
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
- media_transport_remove_owner(transport);
-}
-
-static void bap_disable_complete(struct bt_bap_stream *stream,
- uint8_t code, uint8_t reason,
- void *user_data)
-{
- bap_stop_complete(stream, code, reason, user_data);
-}
-
static guint suspend_bap(struct media_transport *transport,
struct media_owner *owner)
{
@@ -1499,9 +1505,14 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state,
return;
break;
case BT_BAP_STREAM_STATE_STREAMING:
- if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE)
+ if ((bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) ||
+ (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK))
bap_update_bcast_qos(transport);
break;
+ case BT_BAP_STREAM_STATE_RELEASING:
+ if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK)
+ return;
+ break;
}

io = bt_bap_stream_get_io(stream);
--
2.39.2

2023-10-10 16:36:39

by bluez.test.bot

[permalink] [raw]
Subject: RE: Update transport acquire/release flow BAP 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=791844

---Test result---

Test Summary:
CheckPatch PASS 0.94 seconds
GitLint PASS 0.55 seconds
BuildEll PASS 29.34 seconds
BluezMake PASS 1032.60 seconds
MakeCheck PASS 12.40 seconds
MakeDistcheck PASS 164.78 seconds
CheckValgrind PASS 269.16 seconds
CheckSmatch PASS 361.45 seconds
bluezmakeextell PASS 110.17 seconds
IncrementalBuild PASS 1763.22 seconds
ScanBuild PASS 1091.40 seconds



---
Regards,
Linux Bluetooth

2023-10-12 21:50:32

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] Update transport acquire/release flow BAP bcast source

Hello:

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

On Tue, 10 Oct 2023 17:52:40 +0300 you wrote:
> Update transport acquire/release flow for BAP broadcast source to
> fix failure on transport release, and second acquire
>
> Silviu Florian Barbulescu (2):
> transport: Update transport release flow for broadcast source
> bap:Update transport acquire/release flow for bcast source
>
> [...]

Here is the summary with links:
- [v3,1/2] transport: Update transport release flow for bcast src
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=052534ae07b8
- [v3,2/2] bap:Update transport acquire/release flow for bcast src
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e347792f41a8

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