diff options
author | bunnei <bunneidev@gmail.com> | 2021-02-08 20:33:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 20:33:53 +0100 |
commit | 7666c0994ca9b89073625d752b3e0ee8ec3783f1 (patch) | |
tree | 96249040a1d1180b0fb0462c79d5dee226985563 /src/audio_core | |
parent | README Edit for EA (diff) | |
parent | Prevent over scheduling audio events and terminate properly the motion update event (diff) | |
download | yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.tar yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.tar.gz yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.tar.bz2 yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.tar.lz yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.tar.xz yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.tar.zst yuzu-7666c0994ca9b89073625d752b3e0ee8ec3783f1.zip |
Diffstat (limited to 'src/audio_core')
-rw-r--r-- | src/audio_core/stream.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index 5b0b285cd..b0f6f0c34 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp @@ -111,7 +111,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) { |