From fad840cbb6e2024ceb6b93d59bc787776c044a4c Mon Sep 17 00:00:00 2001 From: FrogTheFrog Date: Wed, 11 Dec 2024 22:34:53 +0200 Subject: [PATCH] sonar cloud --- src/display_device.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/display_device.cpp b/src/display_device.cpp index 2ea9c6789eb..a9a21b6ad1b 100644 --- a/src/display_device.cpp +++ b/src/display_device.cpp @@ -81,14 +81,12 @@ namespace display_device { audio_context->released = true; const auto *audio_ctx_ptr = audio_context->audio_ctx_ref.get(); - if (audio_ctx_ptr) { + if (audio_ctx_ptr && !audio::is_audio_ctx_sink_available(*audio_ctx_ptr) && audio_context->retry_counter > 0) { // It is possible that the audio sink is not immediately available after the display is turned on. // Therefore, we will hold on to the audio context a little longer, until it is either available // or we time out. - if (!audio::is_audio_ctx_sink_available(*audio_ctx_ptr) && audio_context->retry_counter > 0) { - --audio_context->retry_counter; - return; - } + --audio_context->retry_counter; + return; } }