* [PATCH BlueZ v2] media: use custom DBus timeouts only when remote side is waiting
@ 2026-06-14 11:22 Pauli Virtanen
2026-06-14 12:45 ` [BlueZ,v2] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Pauli Virtanen @ 2026-06-14 11:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
Under high system load (VM instance on boot) it's observed the 3 sec
timeout BlueZ uses for BAP broadcast SetConfiguration may be missed by
Wireplumber, as these are set up immediately on startup together with
any other setup (eg ALSA) that may need time.
There's no actual need for using a short custom timeout in BlueZ for
this, as in this case there is no remote side that is waiting for a reply.
Fix by limiting custom timeouts to cases where there is a waiting
remote, and use separate defines for A2DP and BAP.
---
Notes:
v2: shorter BAP_REQUEST_TIMEOUT_MSEC, no particular reason to have
it 20 sec. Use that for cases where there may be remote side,
i.e. all except us being bcast source.
profiles/audio/media.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index cdaafb04e..5d9ea2cbc 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -71,7 +71,11 @@
#define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
#define MEDIA_PLAYER_INTERFACE "org.mpris.MediaPlayer2.Player"
-#define REQUEST_TIMEOUT (3 * 1000) /* 3 seconds */
+/* Timeout should be less than avdtp request timeout (4 seconds) */
+#define A2DP_REQUEST_TIMEOUT_MSEC (3 * 1000)
+
+/* Timeout should be less than ATT timeout (30 seconds) */
+#define BAP_REQUEST_TIMEOUT_MSEC (3 * 1000)
struct media_app {
struct media_adapter *adapter;
@@ -465,16 +469,16 @@ static gboolean media_endpoint_async_call(DBusMessage *msg,
struct media_transport *transport,
media_endpoint_cb_t cb,
void *user_data,
- GDestroyNotify destroy)
+ GDestroyNotify destroy,
+ int timeout_msec)
{
struct endpoint_request *request;
request = g_new0(struct endpoint_request, 1);
- /* Timeout should be less than avdtp request timeout (4 seconds) */
if (g_dbus_send_message_with_reply(btd_get_dbus_connection(),
msg, &request->call,
- REQUEST_TIMEOUT) == FALSE) {
+ timeout_msec) == FALSE) {
error("D-Bus send failed");
g_free(request);
return FALSE;
@@ -521,7 +525,7 @@ static gboolean select_configuration(struct media_endpoint *endpoint,
DBUS_TYPE_INVALID);
return media_endpoint_async_call(msg, endpoint, NULL,
- cb, user_data, destroy);
+ cb, user_data, destroy, -1);
}
static int transport_device_cmp(gconstpointer data, gconstpointer user_data)
@@ -604,7 +608,8 @@ static gboolean set_configuration(struct media_endpoint *endpoint,
g_dbus_get_properties(conn, path, "org.bluez.MediaTransport1", &iter);
return media_endpoint_async_call(msg, endpoint, transport,
- cb, user_data, destroy);
+ cb, user_data, destroy,
+ A2DP_REQUEST_TIMEOUT_MSEC);
}
#endif
@@ -1093,7 +1098,7 @@ static int pac_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
dbus_message_iter_close_container(&iter, &dict);
if (!media_endpoint_async_call(msg, endpoint, NULL, pac_select_cb,
- data, free))
+ data, free, -1))
return -EIO;
return 0;
@@ -1233,6 +1238,7 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
DBusMessage *msg;
DBusMessageIter iter;
const char *path;
+ int timeout_msec;
DBG("endpoint %p stream %p", endpoint, stream);
@@ -1243,9 +1249,16 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
switch (bt_bap_stream_get_type(stream)) {
case BT_BAP_STREAM_TYPE_UCAST:
transport = pac_ucast_config(stream, cfg, endpoint);
+ timeout_msec = BAP_REQUEST_TIMEOUT_MSEC;
break;
case BT_BAP_STREAM_TYPE_BCAST:
transport = pac_bcast_config(stream, cfg, endpoint);
+
+ /* If we are sink, BASS remote may be waiting: custom timeout */
+ if (bt_bap_stream_get_dir(stream) == BT_BAP_SOURCE)
+ timeout_msec = BAP_REQUEST_TIMEOUT_MSEC;
+ else
+ timeout_msec = -1;
break;
default:
transport = NULL;
@@ -1279,7 +1292,8 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
g_dbus_get_properties(conn, path, "org.bluez.MediaTransport1", &iter);
if (!media_endpoint_async_call(msg, endpoint, transport,
- pac_config_cb, data, free))
+ pac_config_cb, data, free,
+ timeout_msec))
return -EIO;
return 0;
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [BlueZ,v2] media: use custom DBus timeouts only when remote side is waiting
2026-06-14 11:22 [PATCH BlueZ v2] media: use custom DBus timeouts only when remote side is waiting Pauli Virtanen
@ 2026-06-14 12:45 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-06-14 12:45 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 988 bytes --]
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=1111256
---Test result---
Test Summary:
CheckPatch PASS 0.28 seconds
GitLint PASS 0.19 seconds
BuildEll PASS 13.32 seconds
BluezMake PASS 468.50 seconds
MakeCheck PASS 3.02 seconds
MakeDistcheck PASS 152.22 seconds
CheckValgrind PASS 130.35 seconds
CheckSmatch PASS 204.38 seconds
bluezmakeextell PASS 102.95 seconds
IncrementalBuild PASS 462.75 seconds
ScanBuild PASS 580.85 seconds
https://github.com/bluez/bluez/pull/2233
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-14 12:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-14 11:22 [PATCH BlueZ v2] media: use custom DBus timeouts only when remote side is waiting Pauli Virtanen
2026-06-14 12:45 ` [BlueZ,v2] " 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