diff options
author | Liam <byteslice@airmail.cc> | 2023-06-04 18:56:40 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-06-04 19:00:10 +0200 |
commit | e96a3a171355323453bf0689b80e9b2279750495 (patch) | |
tree | 6c44cc3407c887b1bd4bcdaec321123932a07ca7 /src/audio_core/sink | |
parent | Merge pull request #10588 from liamwhite/vfs-cached (diff) | |
download | yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.gz yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.bz2 yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.lz yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.xz yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.zst yuzu-e96a3a171355323453bf0689b80e9b2279750495.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/sink/sink_stream.cpp | 5 | ||||
-rw-r--r-- | src/audio_core/sink/sink_stream.h | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 2331aaff9..f44fedfd5 100644 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -269,12 +269,13 @@ u64 SinkStream::GetExpectedPlayedSampleCount() { return std::min<u64>(exp_played_sample_count, max_played_sample_count) + TargetSampleCount * 3; } -void SinkStream::WaitFreeSpace() { +void SinkStream::WaitFreeSpace(std::stop_token stop_token) { std::unique_lock lk{release_mutex}; release_cv.wait_for(lk, std::chrono::milliseconds(5), [this]() { return queued_buffers < max_queue_size; }); if (queued_buffers > max_queue_size + 3) { - release_cv.wait(lk, [this]() { return queued_buffers < max_queue_size; }); + Common::CondvarWait(release_cv, lk, stop_token, + [this] { return queued_buffers < max_queue_size; }); } } diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h index 21b5b40a1..41cbadc9c 100644 --- a/src/audio_core/sink/sink_stream.h +++ b/src/audio_core/sink/sink_stream.h @@ -13,6 +13,7 @@ #include "audio_core/common/common.h" #include "common/common_types.h" +#include "common/polyfill_thread.h" #include "common/reader_writer_queue.h" #include "common/ring_buffer.h" #include "common/thread.h" @@ -210,7 +211,7 @@ public: /** * Waits for free space in the sample ring buffer */ - void WaitFreeSpace(); + void WaitFreeSpace(std::stop_token stop_token); protected: /// Core system @@ -252,7 +253,7 @@ private: /// Set via IAudioDevice service calls f32 device_volume{1.0f}; /// Signalled when ring buffer entries are consumed - std::condition_variable release_cv; + std::condition_variable_any release_cv; std::mutex release_mutex; }; |