From a790009a630ebf12772ead2915ca9d59ee7fdf72 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 14 Nov 2015 21:44:59 +0100 Subject: player: account for minor VO underruns If the player sends a frame with duration==0 to the VO, it can trivially underrun. Don't panic, but keep the correct time. Also, returning the absolute time from vo_get_next_frame_start_time() just to turn it into a float with relative time was silly. Rename it and make it return what the caller needs. --- player/video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/video.c b/player/video.c index 043abeb3b1..531ad2ee06 100644 --- a/player/video.c +++ b/player/video.c @@ -1025,8 +1025,8 @@ static void handle_display_sync_frame(struct MPContext *mpctx, // Estimate the video position, so we can calculate a good A/V difference // value below. This is used to estimate A/V drift. - double time_left = (vo_get_next_frame_start_time(vo) - mp_time_us()) / 1e6; - time_left = MPMAX(time_left, 0); + double time_left = vo_get_delay(vo); + // We also know that the timing is (necessarily) off, because we have to // align frame timings on the vsync boundaries. This is unavoidable, and // for the sake of the A/V sync calculations we pretend it's perfect. -- cgit v1.2.3