From 68201f4591bd07c7d7027d50fdb6cc5500c7382c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 14 Aug 2017 14:02:13 +0200 Subject: player: make refresh seeks slightly more robust Refresh seeks are automatically issued when changing filters, which improves user experience if these filters change buffering or such. The refresh seek could actually overwrite a previously ongoing seek: set pause yes set time-pos 10 set vf "" Here, the video code issued a refresh seek to the previous video position, which could be different from the previously triggered (and still ongoing) seek, this overwriting the seek. Factor all refresh seek handling into a new function, and make it handle ongoing seeks correctly. Remove the weird new canonical_pts field, which actually had no use. Fixes #4757. --- player/playloop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'player/playloop.c') diff --git a/player/playloop.c b/player/playloop.c index 0d3409065b..ea73981a4f 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -232,6 +232,7 @@ void reset_playback_state(struct MPContext *mpctx) mpctx->hrseek_framedrop = false; mpctx->hrseek_lastframe = false; mpctx->hrseek_backstep = false; + mpctx->current_seek = (struct seek_params){0}; mpctx->playback_pts = MP_NOPTS_VALUE; mpctx->last_seek_pts = MP_NOPTS_VALUE; mpctx->cache_wait_time = 0; @@ -377,7 +378,7 @@ static void mp_seek(MPContext *mpctx, struct seek_params seek) mpctx->ab_loop_clip = mpctx->last_seek_pts < opts->ab_loop[1]; - mpctx->canonical_pts = mpctx->last_seek_pts; + mpctx->current_seek = seek; } // This combines consecutive seek requests. @@ -958,8 +959,6 @@ static void handle_playback_time(struct MPContext *mpctx) { mpctx->playback_pts = playing_audio_pts(mpctx); } - if (mpctx->playback_pts != MP_NOPTS_VALUE) - mpctx->canonical_pts = mpctx->playback_pts; } // We always make sure audio and video buffers are filled before actually @@ -993,6 +992,7 @@ static void handle_playback_restart(struct MPContext *mpctx) if (!mpctx->restart_complete) { mpctx->hrseek_active = false; mpctx->restart_complete = true; + mpctx->current_seek = (struct seek_params){0}; mpctx->audio_allow_second_chance_seek = false; handle_playback_time(mpctx); mp_notify(mpctx, MPV_EVENT_PLAYBACK_RESTART, NULL); -- cgit v1.2.3