[vlc-devel] [PATCH 4/6] video_output: conditionnally render on display

Alexandre Janniaux ajanni at videolabs.io
Fri Feb 5 09:01:55 UTC 2021


Don't prepare/display if rendering is disabled. Rendering can only be
disabled when taking the display_lock so the prepare/display cannot be
done partially because of this patch.
---
 src/video_output/video_output.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index d225e56d8d..11c50871c1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1405,7 +1405,7 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
     const unsigned frame_rate = todisplay->format.i_frame_rate;
     const unsigned frame_rate_base = todisplay->format.i_frame_rate_base;
 
-    if (vd->ops->prepare != NULL)
+    if (vd->ops->prepare != NULL && sys->rendering_enabled)
         vd->ops->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);
 
     vout_chrono_Stop(&sys->render);
@@ -1452,7 +1452,9 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
                           frame_rate, frame_rate_base);
 
     /* Display the direct buffer returned by vout_RenderPicture */
-    vout_display_Display(vd, todisplay);
+    if (sys->rendering_enabled)
+        vout_display_Display(vd, todisplay);
+
     vlc_mutex_unlock(&sys->display_lock);
 
     if (subpic)
-- 
2.28.0



More information about the vlc-devel mailing list