From d8dbe7742701902d762dfa3707e204e50a074ac2 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 10 Apr 2022 19:35:29 -0500 Subject: [PATCH] Tiny EGL code cleanup --- app/streaming/video/ffmpeg-renderers/eglvid.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/streaming/video/ffmpeg-renderers/eglvid.cpp b/app/streaming/video/ffmpeg-renderers/eglvid.cpp index f8371758..d63961c3 100644 --- a/app/streaming/video/ffmpeg-renderers/eglvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/eglvid.cpp @@ -859,7 +859,9 @@ void EGLRenderer::waitToRender() // See comment in renderFrame() for more details. SDL_GL_MakeCurrent(m_Window, m_Context); - if (m_LastRenderSync != 0) { + // Wait for the previous buffer swap to finish before picking the next frame to render. + // This way we'll get the latest available frame and render it without blocking. + if (m_LastRenderSync != EGL_NO_SYNC) { SDL_assert(m_eglClientWaitSync != nullptr); m_eglClientWaitSync(m_EGLDisplay, m_LastRenderSync, EGL_SYNC_FLUSH_COMMANDS_BIT, EGL_FOREVER); }