summaryrefslogtreecommitdiffstats
path: root/src/audio_core/stream.cpp
diff options
context:
space:
mode:
authorgerman <german@thesoftwareartisans.com>2021-02-02 16:59:59 +0100
committergerman <german@thesoftwareartisans.com>2021-02-02 17:17:10 +0100
commit7784b1da6dcd37027c82e1b980b1e79645f18176 (patch)
tree32ce50cc1db92fff2d79b3edd5dbb85c622f4066 /src/audio_core/stream.cpp
parentOnly update motion for npad and prevent over scheduling events (diff)
downloadyuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.tar
yuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.tar.gz
yuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.tar.bz2
yuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.tar.lz
yuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.tar.xz
yuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.tar.zst
yuzu-7784b1da6dcd37027c82e1b980b1e79645f18176.zip
Diffstat (limited to 'src/audio_core/stream.cpp')
-rw-r--r--src/audio_core/stream.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index afe68c9ed..f3373fe04 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -103,7 +103,14 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
- core_timing.ScheduleEvent(GetBufferReleaseNS(*active_buffer) - ns_late, release_event, {});
+ const auto buffer_release_ns = GetBufferReleaseNS(*active_buffer);
+
+ // If ns_late is higher than the update rate ignore the delay
+ if (ns_late > buffer_release_ns) {
+ ns_late = {};
+ }
+
+ core_timing.ScheduleEvent(buffer_release_ns - ns_late, release_event, {});
}
void Stream::ReleaseActiveBuffer(std::chrono::nanoseconds ns_late) {