From 183af9d72eac25efc4b6a6a92249963cec5793f0 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Thu, 20 Oct 2016 11:20:23 -0700 Subject: player: speed up audio/video re-sync when there is a huge delay when there is a huge delay between audio/video sync, it can take a really long time to converge back. this speeds up the resync time by increasing the max_change allowed per iteration. Signed-off-by: wm4 --- player/video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player/video.c b/player/video.c index ff72f92d8e..21babe016e 100644 --- a/player/video.c +++ b/player/video.c @@ -729,8 +729,9 @@ static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time double av_delay = a_pts - v_pts; double change = av_delay * 0.1; + double factor = fabs(av_delay) < 0.3 ? 0.1 : 0.4; double max_change = opts->default_max_pts_correction >= 0 ? - opts->default_max_pts_correction : frame_time * 0.1; + opts->default_max_pts_correction : frame_time * factor; if (change < -max_change) change = -max_change; else if (change > max_change) -- cgit v1.2.3