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>
This commit is contained in:
Aman Gupta 2016-10-20 11:20:23 -07:00 committed by wm4
parent ea03ae157f
commit 183af9d72e
1 changed files with 2 additions and 1 deletions

View File

@ -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)