[vlc-devel] [PATCH v2 05/18] video_output: count the pictures dropped

Steve Lhomme robux4 at ycbcr.xyz
Wed Sep 16 13:14:31 CEST 2020


So far it was possible to get a displayed.current and a displayed.next at once
and realize both are late and skip displayed.current. But it was counted as a
lost frame.
---
 src/video_output/video_output.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index b92bc4ded1f..a6428d9da04 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1472,7 +1472,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
     vout_thread_sys_t *sys = vout;
     bool frame_by_frame = !deadline;
     bool paused = sys->pause.is_on;
-    bool first = !sys->displayed.current;
+    const bool first = !sys->displayed.current;
 
     assert(sys->clock);
 
@@ -1528,7 +1528,10 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
         {
             const vlc_tick_t date_next = next_system_pts - render_delay;
             if (date_next <= system_now)
+            {
+                // the next frame is late, skip the current one
                 drop_next_frame = true;
+            }
 
             if (deadline != NULL) {
                 if (*deadline == VLC_TICK_INVALID || date_next < *deadline)
@@ -1545,6 +1548,13 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
 
     if (drop_next_frame) {
         picture_Release(sys->displayed.current);
+        if (first)
+        {
+            // only count the displayed.current as lost if it was never used
+            vout_statistic_AddLost(&sys->statistic, 1);
+            msg_Warn(&vout->obj, "next picture is late, drop the current one");
+        }
+
         sys->displayed.current = sys->displayed.next;
         sys->displayed.next    = NULL;
     }
-- 
2.26.2



More information about the vlc-devel mailing list