[vlc-devel] [PATCH] vout: don't drop the frame if it's the last one available to display

Steve Lhomme robux4 at videolabs.io
Mon May 15 10:22:43 CEST 2017


From: Steve Lhomme <robUx4 at videolabs.io>

--
replaces https://patches.videolan.org/patch/14651/
- improve the late threshold by using the frame rate if available
---
 src/video_output/video_output.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index efcf9b72eb..f597dbefc3 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -825,9 +825,18 @@ 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) {
+                    picture_t *p_last = picture_fifo_Peek(vout->p->decoder_fifo);
+                    if (p_last)
+                        picture_Release(p_last);
+                    const bool is_last = p_last == NULL;
+                    mtime_t late_threshold;
+                    if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)
+                        late_threshold = 1000 * decoded->format.i_frame_rate / decoded->format.i_frame_rate_base;
+                    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 (!is_last && 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);
-- 
2.12.1



More information about the vlc-devel mailing list