[vlc-devel] [PATCH] vout: fix low framerate stuttering

Romain Vimont rom1v at videolabs.io
Tue Aug 6 15:07:20 CEST 2019


In ThreadDisplayPicture(), when "refresh" was true, the output parameter
deadline was not written and the function returned a non-zero value.

As a consequence, in video_output.c:Thread(), the next loop iteration
waited for the max deadline (100ms). When the following frame target
date was before this deadline, the video was stuttering.

To avoid the problem, write the deadline before returning from
ThreadDisplayPicture(), so that Thread() does not wait more than
expected.

Since an existing frame is refreshed only every 80ms
(VOUT_REDISPLAY_DELAY), this happened only on low framerate videos
(<12.5 fps). Otherwise, "refresh" was always false and the problem never
occurred.
---
You can test with this video at 10fps: https://tmp.rom1v.com/10fps.mp4

 src/video_output/video_output.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 4a2cde9f98..ef0d9488ae 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1243,13 +1243,14 @@ static int ThreadDisplayPicture(vout_thread_t *vout, vlc_tick_t *deadline)
     }
     bool force_refresh = !drop_next_frame && refresh;
 
+    if (!frame_by_frame) {
+        if (date_refresh != VLC_TICK_INVALID)
+            *deadline = date_refresh;
+        if (date_next != VLC_TICK_INVALID && date_next < *deadline)
+            *deadline = date_next;
+    }
+
     if (!first && !refresh && !drop_next_frame) {
-        if (!frame_by_frame) {
-            if (date_refresh != VLC_TICK_INVALID)
-                *deadline = date_refresh;
-            if (date_next != VLC_TICK_INVALID && date_next < *deadline)
-                *deadline = date_next;
-        }
         return VLC_EGENERIC;
     }
 
-- 
2.23.0.rc1



More information about the vlc-devel mailing list