Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v5 0/6] bap: Release cached ASEs on ClearConfiguration
@ 2026-11-12 20:37 Luiz Augusto von Dentz
  2026-11-12 20:37 ` [PATCH BlueZ v5 1/6] shared/bap: Add bt_bap_foreach_stream and bt_bap_stream_get_rpac Luiz Augusto von Dentz
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2026-11-12 20:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

An acceptor may keep an ASE in Codec Configured, caching its codec
configuration, once the initiator removes the transport. The initiator
then has no way to get rid of it, as it no longer has a transport to
release.

Release such cached ASEs on ClearConfiguration of an endpoint, and add
endpoint.clear to bluetoothctl to exercise it, with a functional test.

This series is independent of the other two.

v5: Complete the release of a cached ASE once it leaves Releasing, to Idle
    or back to Codec Configured as some servers do, and don't release it
    again while a release is pending.
v4: Complete every pending release of a stream once it is idle, including
    the ones left behind by a failed release.
v3: Reply to ClearConfiguration once the cached ASEs are idle, and
    report a failed release as an error.
v2: Wait for the release of the cached ASEs before replying, validate the
    transport path of endpoint.clear and update the remote PAC of an ASE
    when it is reused (new patch 2/6).

Luiz Augusto von Dentz (6):
  shared/bap: Add bt_bap_foreach_stream and bt_bap_stream_get_rpac
  shared/bap: Update the remote PAC when reusing an ASE
  bap: Release cached ASEs on ClearConfiguration of an endpoint
  client/player: Add endpoint.clear command
  doc/functional-bap: Document clearing a cached configuration
  test: functional: Cover clearing a cached configuration

 client/player.c               |  57 +++++++++++
 doc/bluetoothctl-endpoint.rst |  20 ++++
 doc/functional-bap.rst        |  24 +++++
 profiles/audio/bap.c          | 178 ++++++++++++++++++++++++++++++++--
 src/shared/bap.c              |  32 ++++++
 src/shared/bap.h              |   8 ++
 test/functional/test_bap.py   |  23 +++++
 7 files changed, 333 insertions(+), 9 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH BlueZ v2 1/6] shared/bap: Add bt_bap_foreach_stream and bt_bap_stream_get_rpac
@ 2026-11-11 16:25 Luiz Augusto von Dentz
  2026-11-11 19:27 ` bap: Release cached ASEs on ClearConfiguration bluez.test.bot
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2026-11-11 16:25 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Allow iterating over the streams of a session and getting the remote
PAC of a stream, so streams can be found by their remote endpoint.

Assisted-by: Claude:claude-opus-5-5
---
 src/shared/bap.c | 31 +++++++++++++++++++++++++++++++
 src/shared/bap.h |  8 ++++++++
 2 files changed, 39 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 8cb7fb40f16c..e45d12144acb 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -4740,6 +4740,14 @@ bool bt_bap_stream_is_client(struct bt_bap_stream *stream)
 	return stream->client;
 }
 
+struct bt_bap_pac *bt_bap_stream_get_rpac(struct bt_bap_stream *stream)
+{
+	if (!stream)
+		return NULL;
+
+	return stream->rpac;
+}
+
 uint8_t bt_bap_stream_get_type(struct bt_bap_stream *stream)
 {
 	if (!stream)
@@ -7020,6 +7028,29 @@ struct bt_bap *bt_bap_stream_get_session(struct bt_bap_stream *stream)
 	return stream->bap;
 }
 
+struct stream_foreach_data {
+	bt_bap_stream_foreach_t func;
+	void *user_data;
+};
+
+static void stream_foreach(void *data, void *user_data)
+{
+	struct stream_foreach_data *d = user_data;
+
+	d->func(data, d->user_data);
+}
+
+void bt_bap_foreach_stream(struct bt_bap *bap, bt_bap_stream_foreach_t func,
+							void *user_data)
+{
+	struct stream_foreach_data d = { func, user_data };
+
+	if (!bap || !func)
+		return;
+
+	queue_foreach(bap->streams, stream_foreach, &d);
+}
+
 uint8_t bt_bap_stream_get_state(struct bt_bap_stream *stream)
 {
 	if (!stream)
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 242bfbb39b30..00b74de0f272 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -124,6 +124,8 @@ uint8_t bt_bap_stream_get_type(struct bt_bap_stream *stream);
 
 bool bt_bap_stream_is_client(struct bt_bap_stream *stream);
 
+struct bt_bap_pac *bt_bap_stream_get_rpac(struct bt_bap_stream *stream);
+
 struct bt_bap_stream *bt_bap_pac_get_stream(struct bt_bap_pac *pac);
 
 /* Session related function */
@@ -172,6 +174,12 @@ const char *bt_bap_stream_statestr(uint8_t state);
 void bt_bap_foreach_pac(struct bt_bap *bap, uint8_t type,
 			bt_bap_pac_foreach_t func, void *user_data);
 
+typedef void (*bt_bap_stream_foreach_t)(struct bt_bap_stream *stream,
+							void *user_data);
+
+void bt_bap_foreach_stream(struct bt_bap *bap, bt_bap_stream_foreach_t func,
+							void *user_data);
+
 int bt_bap_pac_get_vendor_codec(struct bt_bap_pac *pac, uint8_t *id,
 				uint16_t *cid, uint16_t *vid,
 				struct iovec **data, struct iovec **metadata);
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-13  3:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 20:37 [PATCH BlueZ v5 0/6] bap: Release cached ASEs on ClearConfiguration Luiz Augusto von Dentz
2026-11-12 20:37 ` [PATCH BlueZ v5 1/6] shared/bap: Add bt_bap_foreach_stream and bt_bap_stream_get_rpac Luiz Augusto von Dentz
2026-11-13  3:42   ` bap: Release cached ASEs on ClearConfiguration bluez.test.bot
2026-11-12 20:37 ` [PATCH BlueZ v5 2/6] shared/bap: Update the remote PAC when reusing an ASE Luiz Augusto von Dentz
2026-11-12 20:37 ` [PATCH BlueZ v5 3/6] bap: Release cached ASEs on ClearConfiguration of an endpoint Luiz Augusto von Dentz
2026-11-12 20:37 ` [PATCH BlueZ v5 4/6] client/player: Add endpoint.clear command Luiz Augusto von Dentz
2026-11-12 20:37 ` [PATCH BlueZ v5 5/6] doc/functional-bap: Document clearing a cached configuration Luiz Augusto von Dentz
2026-11-12 20:37 ` [PATCH BlueZ v5 6/6] test: functional: Cover " Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2026-11-11 16:25 [PATCH BlueZ v2 1/6] shared/bap: Add bt_bap_foreach_stream and bt_bap_stream_get_rpac Luiz Augusto von Dentz
2026-11-11 19:27 ` bap: Release cached ASEs on ClearConfiguration bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox