From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> 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 77f195436032..7e02bcca1a01 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.0