vlc | branch: master | Romain Vimont <ro...@videolabs.io> | Tue Aug  6 15:07:20 
2019 +0200| [6c5eabe76fd6f4827adc7b9931e8519b8a157b66] | committer: Thomas 
Guillem

vout: fix low framerate stuttering

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.

Signed-off-by: Thomas Guillem <tho...@gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c5eabe76fd6f4827adc7b9931e8519b8a157b66
---

 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;
     }
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to