From ec59857a98f3d38a203966302c41503423867e51 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 15 Nov 2026 00:48:18 -0600 Subject: [PATCH] Fix V-Sync wait when frame period was less than 3 ms --- app/streaming/video/ffmpeg-renderers/pacer/pacer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/streaming/video/ffmpeg-renderers/pacer/pacer.cpp b/app/streaming/video/ffmpeg-renderers/pacer/pacer.cpp index bbe7ca26..5a08b075 100644 --- a/app/streaming/video/ffmpeg-renderers/pacer/pacer.cpp +++ b/app/streaming/video/ffmpeg-renderers/pacer/pacer.cpp @@ -276,7 +276,10 @@ void Pacer::handleVsync(int timeUntilNextVsyncMillis) if (m_PacingQueue.isEmpty()) { // Wait for a frame to arrive or our V-sync timeout to expire - if (!m_PacingQueueNotEmpty.wait(&m_FrameQueueLock, SDL_max(timeUntilNextVsyncMillis, TIMER_SLACK_MS) - TIMER_SLACK_MS)) { + unsigned long waitTimeMs = timeUntilNextVsyncMillis > 0 + ? SDL_max(timeUntilNextVsyncMillis - TIMER_SLACK_MS, 1) + : 0; + if (!m_PacingQueueNotEmpty.wait(&m_FrameQueueLock, waitTimeMs)) { // Wait timed out - unlock and bail m_FrameQueueLock.unlock(); return;