[vlc-devel] [PATCH 11/17] video_output: only apply the render delay if we know the next render deadline

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 14 16:03:22 CEST 2020


If deadline is VLC_TICK_INVALID we should not do any math on it.

Do the math outside of ThreadDisplayPicture, it's not needed/used in frame by
frame mode
---
 src/video_output/video_output.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index dc5e602002e..758df6e017d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1498,7 +1498,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
             ;
 
     const vlc_tick_t system_now = vlc_tick_now();
-    const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->render) + VOUT_MWAIT_TOLERANCE;
 
     bool drop_next_frame = frame_by_frame;
     vlc_tick_t date_next = VLC_TICK_INVALID;
@@ -1514,7 +1513,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
             paused = true;
         }
         {
-            date_next = next_system_pts - render_delay;
+            date_next = next_system_pts;
             if (date_next <= system_now)
                 drop_next_frame = true;
         }
@@ -1533,7 +1532,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
 
     vlc_tick_t date_refresh = VLC_TICK_INVALID;
     if (sys->displayed.date != VLC_TICK_INVALID) {
-        date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY - render_delay;
+        date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY;
         refresh = date_refresh <= system_now;
     }
     bool force_refresh = !drop_next_frame && refresh;
@@ -1903,6 +1902,8 @@ static void *Thread(void *object)
         }
 
         wait = ThreadDisplayPicture(vout, &deadline) != VLC_SUCCESS;
+        if (deadline != VLC_TICK_INVALID)
+            deadline -= vout_chrono_GetHigh(&sys->render) + VOUT_MWAIT_TOLERANCE;
 
         const bool picture_interlaced = sys->displayed.is_interlaced;
 
-- 
2.26.2



More information about the vlc-devel mailing list