[vlc-devel] [PATCH 14/17] video_output: set the deadline directly when the next frame date is known

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


No need for an intermediate variable to set the variable later.

We already know the deadline from the previous frame timeout, the deadline for
the next frame takes precedence if there is one.
---
 src/video_output/video_output.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 39fa523d51a..711b15393b6 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1500,7 +1500,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
     const vlc_tick_t system_now = vlc_tick_now();
 
     bool drop_next_frame = frame_by_frame;
-    vlc_tick_t date_next = VLC_TICK_INVALID;
 
     /* FIXME/XXX we must redisplay the last decoded picture (because
      * of potential vout updated, or filters update or SPU update)
@@ -1530,20 +1529,20 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
              * the current one). */
             paused = true;
         }
+        else
         {
-            date_next = next_system_pts;
-            if (date_next <= system_now)
+            if (!frame_by_frame) {
+                if (*deadline == VLC_TICK_INVALID || *deadline > next_system_pts)
+                    *deadline = next_system_pts;
+            }
+
+            if (next_system_pts <= system_now)
                 drop_next_frame = true;
         }
     }
 
     bool force_refresh = !drop_next_frame && refresh;
 
-    if (!frame_by_frame) {
-        if (date_next != VLC_TICK_INVALID && date_next < *deadline)
-            *deadline = date_next;
-    }
-
     if (!first && !refresh && !drop_next_frame) {
         return VLC_EGENERIC;
     }
-- 
2.26.2



More information about the vlc-devel mailing list