vlc/vlc-3.0 | branch: master | Romain Vimont <[email protected]> | Tue Aug  6 
15:07:20 2019 +0200| [7c351860333b60b3db08daea4afad0e8384425de] | committer: 
Hugo Beauzée-Luyssen

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 <[email protected]>
(cherry picked from commit 6c5eabe76fd6f4827adc7b9931e8519b8a157b66)
Signed-off-by: Hugo Beauzée-Luyssen <[email protected]>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7c351860333b60b3db08daea4afad0e8384425de
---

 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 566dd5078a..d552160bef 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1225,13 +1225,14 @@ static int ThreadDisplayPicture(vout_thread_t *vout, 
mtime_t *deadline)
     }
     bool force_refresh = !drop_next_frame && refresh;
 
+    if (!frame_by_frame) {
+        if (date_refresh != VLC_TS_INVALID)
+            *deadline = date_refresh;
+        if (date_next != VLC_TS_INVALID && date_next < *deadline)
+            *deadline = date_next;
+    }
+
     if (!first && !refresh && !drop_next_frame) {
-        if (!frame_by_frame) {
-            if (date_refresh != VLC_TS_INVALID)
-                *deadline = date_refresh;
-            if (date_next != VLC_TS_INVALID && date_next < *deadline)
-                *deadline = date_next;
-        }
         return VLC_EGENERIC;
     }
 

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to