path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2020-02-28 01:37:41 +0100
committerwm4 <wm4@nowhere>2020-02-28 02:14:12 +0100
commitefe43d768fa4dd13329dfa69831aedbdff948718 (patch)
tree2b732385c9ffcd037fdbee6ea5b25416dd590000 /player/video.c
parent009d1ffda6cc5438d7287b2971d17e866ebc86c0 (diff)
player: set playback_pts in hr-seek past EOF case
Hr-seek past the last frame instantly enters EOF, which means handle_playback_time() will not set playback_pts to the video PTS (as all video frames are skipped), which leads to the playback time being taken from the last seek target. This results in confusing behavior, especially since the seek time will be clipped to the file duration for display, but not for further relative seeks. Obviously, the time should be set to the last video frame, so use the last video frame as fallback if both audio and video have ended. Also, since the same problem exists with audio-only playback, add a fallback for audio PTS too. We don't know which was the "last" fragment of media played (to decide whether to use the audio or video PTS as the fallback), but it doesn't matter since the maximum works. This could lead to some undesired effects. In particular the audio PTS is basically a bad guess, and is for example not clipped against --end. (But the ridiculous way audio syncing and clamping currently works, I'm not going to touch that shit unless I rewrite it completely.) The cover art case is slightly broken: using --keep-open with keyframe seeks will result in 0 as playback PTS (the video PTS). OK, who cares, it got late. Also casually get rid of last_vo_pts, since that barely made any sense at all. Fixes: #7487
Diffstat (limited to 'player/video.c')
1 files changed, 0 insertions, 1 deletions
diff --git a/player/video.c b/player/video.c
index 3f5919a25f..5d9879bc51 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1169,7 +1169,6 @@ void write_video(struct MPContext *mpctx)
mpctx->video_pts = mpctx->next_frames[0]->pts;
- mpctx->last_vo_pts = mpctx->video_pts;
mpctx->last_frame_duration =
mpctx->next_frames[0]->pkt_duration / mpctx->video_speed;