mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 11:42:04 +00:00
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:
parent
ea03ae157f
commit
183af9d72e
@ -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 av_delay = a_pts - v_pts;
|
||||||
|
|
||||||
double change = av_delay * 0.1;
|
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 ?
|
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)
|
if (change < -max_change)
|
||||||
change = -max_change;
|
change = -max_change;
|
||||||
else if (change > max_change)
|
else if (change > max_change)
|
||||||
|
Loading…
Reference in New Issue
Block a user