[vlc-devel] [PATCH 1/4] video_output: count the time to do the prepare to determine if a frame is late

Steve Lhomme robux4 at ycbcr.xyz
Thu Jan 21 12:09:57 UTC 2021


The system_pts is the date we should do the swap (vd->display) for the picture.
But between now and the time we do the swap, there is also the prepare
(+ static filtering) that will happen. We are late if now+that duration is
after the date we should do the swap.
---
 src/video_output/video_output.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index eeb49e9ab62..19fe940fd87 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1094,7 +1094,9 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus
                 }
                 else if (is_late_dropped && !decoded->b_force)
                 {
-                    vlc_tick_t late = system_now - system_pts;
+                    const vlc_tick_t prepare_decoded_duration = vout_chrono_GetHigh(&sys->render) +
+                                                                VOUT_MWAIT_TOLERANCE;
+                    vlc_tick_t late = system_now + prepare_decoded_duration - system_pts;
 
                     vlc_tick_t late_threshold;
                     if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base) {
-- 
2.29.2



More information about the vlc-devel mailing list