Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] a2dp: Don't suspend a sink stream on our own
@ 2026-11-25 17:02 Simon Mikuda
  2026-11-25 23:51 ` [BlueZ,v2] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-25 17:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

When the remote source starts a stream that no transport owner takes
within 5 seconds, or the owner goes away without Release(), BlueZ
suspends the stream. Some phones then wait for us to resume it and
never start it again. PTS GAVDP/ACP/APP/TRC/BV-02-C fails the same way.

Leave suspending a sink stream to the remote source. Release() still
suspends it, and source streams keep the timer. A sink transport whose
owner goes away while the stream plays is now pending, not idle, so it
can be acquired again.

Assisted-by: Claude:claude-opus-5-5
---
Changes in v2:
- transport: a sink transport whose owner goes away while the stream
  plays is pending, not idle, so TryAcquire() works again

 profiles/audio/a2dp.c      |  8 ++++++--
 profiles/audio/transport.c | 13 ++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 3eb3e3bfd..d4d100986 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1409,7 +1409,10 @@ static gboolean start_ind(struct avdtp *session, struct avdtp_local_sep *sep,
 	if (!a2dp_stream)
 		return FALSE;
 
-	if (!a2dp_stream->locked)
+	/* Leave suspending a sink stream to the remote source: some phones
+	 * wait for us to resume a stream we suspended.
+	 */
+	if (!a2dp_stream->locked && a2dp_sep->type == AVDTP_SEP_TYPE_SOURCE)
 		a2dp_stream->suspend_timer = timeout_add_seconds(
 					SUSPEND_TIMEOUT,
 					(timeout_func_t) suspend_timeout,
@@ -3604,7 +3607,8 @@ gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session)
 		/* Set timer here */
 		break;
 	case AVDTP_STATE_STREAMING:
-		if (avdtp_suspend(session, stream->stream) == 0)
+		if (sep->type == AVDTP_SEP_TYPE_SOURCE &&
+				avdtp_suspend(session, stream->stream) == 0)
 			stream->suspending = TRUE;
 		break;
 	case AVDTP_STATE_IDLE:
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index ad2fc2c1c..0e22e1188 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -458,6 +458,7 @@ static guint transport_a2dp_suspend(struct media_transport *transport,
 	struct a2dp_transport *a2dp = transport->data;
 	struct media_endpoint *endpoint = transport->endpoint;
 	struct a2dp_sep *sep = media_endpoint_get_sep(endpoint);
+	struct avdtp_stream *stream;
 
 	if (owner != NULL) {
 		if (a2dp->resume_id) {
@@ -469,7 +470,17 @@ static guint transport_a2dp_suspend(struct media_transport *transport,
 									owner);
 	}
 
-	transport_set_state(transport, TRANSPORT_STATE_IDLE);
+	/* A sink stream is left for the remote to suspend: until then it is
+	 * playing, just not acquired.
+	 */
+	stream = transport_a2dp_get_stream(transport);
+
+	if (!strcmp(media_endpoint_get_uuid(endpoint), A2DP_SINK_UUID) &&
+			avdtp_stream_get_state(stream) == AVDTP_STATE_STREAMING)
+		transport_set_state(transport, TRANSPORT_STATE_PENDING);
+	else
+		transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
 	a2dp_sep_unlock(sep, a2dp->session);
 
 	return 0;

base-commit: 1608f836188610aabeff5a3164169ebe0360e443
-- 
2.43.0


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

* RE: [BlueZ,v2] a2dp: Don't suspend a sink stream on our own
  2026-11-25 17:02 [PATCH BlueZ v2] a2dp: Don't suspend a sink stream on our own Simon Mikuda
@ 2026-11-25 23:51 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-25 23:51 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1021 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/series/1222367/

---Test result---

Test Summary:
CheckPatch                    PASS      0.37 seconds
GitLint                       PASS      0.25 seconds
BuildEll                      PASS      20.25 seconds
BluezMake                     PASS      308.29 seconds
MakeCheck                     PASS      3.42 seconds
MakeDistcheck                 PASS      145.82 seconds
CheckValgrind                 PASS      158.37 seconds
CheckSmatch                   PASS      315.36 seconds
bluezmakeextell               PASS      99.44 seconds
TestFunctional                PASS      1215.37 seconds
IncrementalBuild              PASS      311.86 seconds
ScanBuild                     PASS      1186.14 seconds



https://github.com/bluez/bluez/pull/2925

---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2026-11-25 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 17:02 [PATCH BlueZ v2] a2dp: Don't suspend a sink stream on our own Simon Mikuda
2026-11-25 23:51 ` [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