summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio_core/sink/sink_stream.cpp11
-rw-r--r--src/audio_core/sink/sink_stream.h5
2 files changed, 9 insertions, 7 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 849f862b0..67e194e3c 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -266,19 +266,20 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
266} 266}
267 267
268void SinkStream::Stall() { 268void SinkStream::Stall() {
269 if (stalled) { 269 std::scoped_lock lk{stall_guard};
270 if (stalled_lock) {
270 return; 271 return;
271 } 272 }
272 stalled = true; 273 stalled_lock = system.StallProcesses();
273 system.StallProcesses();
274} 274}
275 275
276void SinkStream::Unstall() { 276void SinkStream::Unstall() {
277 if (!stalled) { 277 std::scoped_lock lk{stall_guard};
278 if (!stalled_lock) {
278 return; 279 return;
279 } 280 }
280 system.UnstallProcesses(); 281 system.UnstallProcesses();
281 stalled = false; 282 stalled_lock.unlock();
282} 283}
283 284
284} // namespace AudioCore::Sink 285} // namespace AudioCore::Sink
diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h
index 38a4b2f51..5fea72ab7 100644
--- a/src/audio_core/sink/sink_stream.h
+++ b/src/audio_core/sink/sink_stream.h
@@ -6,6 +6,7 @@
6#include <array> 6#include <array>
7#include <atomic> 7#include <atomic>
8#include <memory> 8#include <memory>
9#include <mutex>
9#include <span> 10#include <span>
10#include <vector> 11#include <vector>
11 12
@@ -240,8 +241,8 @@ private:
240 f32 system_volume{1.0f}; 241 f32 system_volume{1.0f};
241 /// Set via IAudioDevice service calls 242 /// Set via IAudioDevice service calls
242 f32 device_volume{1.0f}; 243 f32 device_volume{1.0f};
243 /// True if coretiming has been stalled 244 std::mutex stall_guard;
244 bool stalled{false}; 245 std::unique_lock<std::mutex> stalled_lock;
245}; 246};
246 247
247using SinkStreamPtr = std::unique_ptr<SinkStream>; 248using SinkStreamPtr = std::unique_ptr<SinkStream>;