From 469a75ae182a483ecbf71284205dde2508826f84 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 6 Nov 2024 10:22:21 -0500 Subject: [PATCH] sink: Fix transitioning to BTD_SERVICE_STATE_DISCONNECTED on idle If the stream transition to AVDTP_STATE_IDLE it means the stream has been disconnected, not the session, therefore btd_service_disconnecting_complete shall not be called otherwise it may trigger the policy plugin to disconnect AVRCP in cases like codec reconfiguration. Fixes: https://github.com/bluez/bluez/issues/1003 --- profiles/audio/sink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c index 77f195436..7e02bcca1 100644 --- a/profiles/audio/sink.c +++ b/profiles/audio/sink.c @@ -110,6 +110,7 @@ static void avdtp_state_callback(struct btd_device *dev, switch (new_state) { case AVDTP_SESSION_STATE_DISCONNECTED: sink_set_state(sink, SINK_STATE_DISCONNECTED); + btd_service_disconnecting_complete(sink->service, 0); break; case AVDTP_SESSION_STATE_CONNECTING: sink_set_state(sink, SINK_STATE_CONNECTING); @@ -135,8 +136,6 @@ static void stream_state_changed(struct avdtp_stream *stream, switch (new_state) { case AVDTP_STATE_IDLE: - btd_service_disconnecting_complete(sink->service, 0); - if (sink->connect_id > 0) { a2dp_cancel(sink->connect_id); sink->connect_id = 0; -- 2.47.3