diff --git a/app/streaming/video/ffmpeg-renderers/vt.mm b/app/streaming/video/ffmpeg-renderers/vt.mm index 3e532642..45d915c5 100644 --- a/app/streaming/video/ffmpeg-renderers/vt.mm +++ b/app/streaming/video/ffmpeg-renderers/vt.mm @@ -158,6 +158,19 @@ public: return true; } + virtual void waitToRender() override + { + if (m_DisplayLink != nullptr) { + // Vsync is enabled, so wait for a swap before returning + SDL_LockMutex(m_VsyncMutex); + if (SDL_CondWaitTimeout(m_VsyncPassed, m_VsyncMutex, 100) == SDL_MUTEX_TIMEDOUT) { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "V-sync wait timed out after 100 ms"); + } + SDL_UnlockMutex(m_VsyncMutex); + } + } + // Caller frees frame after we return virtual void renderFrame(AVFrame* frame) override { @@ -230,16 +243,6 @@ public: } } - if (m_DisplayLink != nullptr) { - // Vsync is enabled, so wait for a swap before returning - SDL_LockMutex(m_VsyncMutex); - if (SDL_CondWaitTimeout(m_VsyncPassed, m_VsyncMutex, 100) == SDL_MUTEX_TIMEDOUT) { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "V-sync wait timed out after 100 ms"); - } - SDL_UnlockMutex(m_VsyncMutex); - } - // Queue this sample for the next v-sync CMSampleTimingInfo timingInfo = { .duration = kCMTimeInvalid,