[vlc-commits] video_output: adapt the late threshold to the frame rate if there's one

Steve Lhomme git at videolan.org
Tue Feb 20 10:03:23 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 14 12:35:43 2017 +0200| [71416ff3dd5605f9467dc849820f0fcc306eafd7] | committer: Hugo Beauzée-Luyssen

video_output: adapt the late threshold to the frame rate if there's one

(cherry picked from commit d5255d78d2cc7f3939522f26e0c8f971af1d6fc7)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

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

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 640d999e80..dfe2a3b3bc 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -862,9 +862,14 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra
             decoded = picture_fifo_Pop(vout->p->decoder_fifo);
             if (decoded) {
                 if (is_late_dropped && !decoded->b_force) {
+                    mtime_t late_threshold;
+                    if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)
+                        late_threshold = ((CLOCK_FREQ/2) * decoded->format.i_frame_rate_base) / decoded->format.i_frame_rate;
+                    else
+                        late_threshold = VOUT_DISPLAY_LATE_THRESHOLD;
                     const mtime_t predicted = mdate() + 0; /* TODO improve */
                     const mtime_t late = predicted - decoded->date;
-                    if (late > VOUT_DISPLAY_LATE_THRESHOLD) {
+                    if (late > late_threshold) {
                         msg_Warn(vout, "picture is too late to be displayed (missing %"PRId64" ms)", late/1000);
                         picture_Release(decoded);
                         vout_statistic_AddLost(&vout->p->statistic, 1);



More information about the vlc-commits mailing list