Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

audio: fix shutdown deadlock in audio renderer

Liamd881c9f32623
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 6081352a27..d66d04fae8 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -204,6 +204,10 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
// paused and we'll desync, so just play silence.
if (system.IsPaused() || system.IsShuttingDown()) {
if (system.IsShuttingDown()) {
+ {
+ std::scoped_lock lk{release_mutex};
+ queued_buffers.store(0);
+ }
release_cv.notify_one();
}