From e5b016b7bf75dd99545dc231f9c4d38047827c79 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 3 Dec 2019 21:43:32 +0100 Subject: player: don't apply weird timestamp tolerance on backstep Hr-seek has some sort of tolerance against timestamps, where it allows for up to 5ms deviation. This means it can work only for videos with up to 200 FPS framerate. There were complains about how it doesn't work with videos beyond some high fps. (1000 was mentioned, although that sounds more like it's about the limit that .mkv has.) I suspect this is because otherwise, it might be hard to hit a timestamp with --start, which specifies timestamps as integer, and thus will most likely never represent a timestamp exactly. Another part of the problem is that mpv uses 64 bit floats for timestamps, so fractional parts are never represented exactly. (Both the "tolerance" and using floats for timestamps were things introduced before my time.) Anyway, in the backstep case, we can be relatively sure that the timestamp will be exact (as in, the same unmodified value that was returned by the filter chain), so we can make an exception for that, in order to fix backstep. Untested. (For that you have users.) May help with #7208. --- player/video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'player/video.c') diff --git a/player/video.c b/player/video.c index b5f27e77d6..9dbe19cae4 100644 --- a/player/video.c +++ b/player/video.c @@ -457,6 +457,7 @@ static int video_output_image(struct MPContext *mpctx) struct vo_chain *vo_c = mpctx->vo_chain; bool hrseek = false; double hrseek_pts = mpctx->hrseek_pts; + double tolerance = mpctx->hrseek_backstep ? 0 : .005; if (mpctx->video_status == STATUS_SYNCING) { hrseek = mpctx->hrseek_active; // playback_pts is normally only set when audio and video have started @@ -505,7 +506,7 @@ static int video_output_image(struct MPContext *mpctx) mp_pin_out_unread(vo_c->filter->f->pins[1], frame); img = NULL; r = VD_EOF; - } else if (hrseek && (img->pts < hrseek_pts - .005 || + } else if (hrseek && (img->pts < hrseek_pts - tolerance || mpctx->hrseek_lastframe)) { /* just skip - but save in case it was the last frame */ -- cgit v1.2.3