sink: clean up outstanding AVDTP requests if the stream goes away
authorDaniel Beer <daniel.beer@igorinstitute.com>
Fri, 25 Oct 2024 20:21:40 +0000 (09:21 +1300)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 20 Feb 2025 07:43:24 +0000 (16:43 +0900)
If the stream goes IDLE while we have an outstanding request, connect_id
stays non-zero and is never cleared via a completion callback. As a
consequence, the profile on this device will never be connected
successfully again until BlueZ restarts.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
profiles/audio/sink.c

index e0641d71ff73208af56b1330d6a6f99008481e0c..95d6bc4fb9803c4f019afc429067a44e6d742df0 100755 (executable)
@@ -146,6 +146,10 @@ static void stream_state_changed(struct avdtp_stream *stream,
 #ifndef TIZEN_FEATURE_BLUEZ_MODIFY
                btd_service_disconnecting_complete(sink->service, 0);
 #endif
+               if (sink->connect_id > 0) {
+                       a2dp_cancel(sink->connect_id);
+                       sink->connect_id = 0;
+               }
 
                if (sink->disconnect_id > 0) {
                        a2dp_cancel(sink->disconnect_id);