aboutsummaryrefslogtreecommitdiff
path: root/src/audio_core/stream.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-02-08 11:33:53 -0800
committerGitHub <noreply@github.com>2021-02-08 11:33:53 -0800
commiteaacb5047c5418239db19b442b19c1ead89605aa (patch)
tree96249040a1d1180b0fb0462c79d5dee226985563 /src/audio_core/stream.cpp
parent84250e5be533230789fa73d572b552ca0150d9c0 (diff)
parente0c83e305abc90bbfa7d08ce9739fa11df3878df (diff)
Merge pull request #5868 from german77/HandheldFix
Prevent over scheduling audio events and add motion update unschedule event
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 5b0b285cdd..b0f6f0c346 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) {