summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2016-10-20 11:20:23 -0700
committerwm4 <wm4@nowhere>2016-10-21 17:11:26 +0200
commit183af9d72eac25efc4b6a6a92249963cec5793f0 (patch)
tree88b0f65af97f459f30404fc4b4c22d4d1fb3ea1b
parentea03ae157f081a898f5de40d1f8f82371f9df05d (diff)
downloadmpv-183af9d72eac25efc4b6a6a92249963cec5793f0.tar.bz2
mpv-183af9d72eac25efc4b6a6a92249963cec5793f0.tar.xz
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 <wm4@nowhere>
-rw-r--r--player/video.c3
1 files changed, 2 insertions, 1 deletions
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)