Skip to content

Commit f786e94

Browse files
committed
Fix excessive latency with Vulkan video decoding on Nvidia
For yet unknown reasons, high frame queue delay leads to massive decode latency.
1 parent 1caee72 commit f786e94

File tree

1 file changed

+11
-0
lines changed
  • app/streaming/video/ffmpeg-renderers

1 file changed

+11
-0
lines changed

app/streaming/video/ffmpeg-renderers/plvk.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,16 @@ void PlVkRenderer::waitToRender()
661661
return;
662662
}
663663

664+
#ifndef Q_OS_WIN32
664665
// With libplacebo's Vulkan backend, all swap_buffers does is wait for queued
665666
// presents to finish. This happens to be exactly what we want to do here, since
666667
// it lets us wait to select a queued frame for rendering until we know that we
667668
// can present without blocking in renderFrame().
669+
//
670+
// NB: This seems to cause performance problems with the Windows display stack
671+
// (particularly on Nvidia) so we will only do this for non-Windows platforms.
668672
pl_swapchain_swap_buffers(m_Swapchain);
673+
#endif
669674

670675
// Handle the swapchain being resized
671676
int vkDrawableW, vkDrawableH;
@@ -818,6 +823,12 @@ void PlVkRenderer::renderFrame(AVFrame *frame)
818823
goto UnmapExit;
819824
}
820825

826+
#ifdef Q_OS_WIN32
827+
// On Windows, we swap buffers here instead of waitToRender()
828+
// to avoid some performance problems on Nvidia GPUs.
829+
pl_swapchain_swap_buffers(m_Swapchain);
830+
#endif
831+
821832
UnmapExit:
822833
// Delete any textures that need to be destroyed
823834
for (pl_tex texture : texturesToDestroy) {

0 commit comments

Comments
 (0)