0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

mplayer: fix seek display during seeking when playing ordered chapters

The seek bar appeared to be "stuck" to the start of the current chapter.
This is a regression from 630a2b1. This commit assumed that hrseek_pts
would always contain the hrseek target time (when hrseek_active==true).
But this is not always the case: when playing timeline stuff (e.g.
ordered chapters), hrseek framedropping is abused to handle an obscure
corner case, and then hrseek_pts contains something completely unrelated
to the current playback time. See the added comment in mplayer.c and
commit c1232c9.

Fix this by trying something else to get a correct time "during"
hr-seeks. mpctx->restart_playback looks ideal, because it's set while
audio is being synced / audio buffers being filled, so we know that the
audio time is probably bogus while it is set. Let's hope this is
correct.
This commit is contained in:
wm4 2013-02-13 13:22:12 +01:00
parent 9e85d2ac13
commit f9a259e5d5

View File

@ -2872,6 +2872,12 @@ static int seek(MPContext *mpctx, struct seek_params seek,
} else
mpctx->last_seek_pts = MP_NOPTS_VALUE;
// The hr_seek==false case is for skipping frames with PTS before the
// current timeline chapter start. It's not really known where the demuxer
// level seek will end up, so the hrseek mechanism is abused to skip all
// frames before chapter start by setting hrseek_pts to the chapter start.
// It does nothing when the seek is inside of the current chapter, and
// seeking past the chapter is handled elsewhere.
if (hr_seek || mpctx->timeline) {
mpctx->hrseek_active = true;
mpctx->hrseek_framedrop = true;
@ -2958,15 +2964,15 @@ double get_current_time(struct MPContext *mpctx)
return 0;
if (demuxer->stream_pts != MP_NOPTS_VALUE)
return demuxer->stream_pts;
if (mpctx->hrseek_active)
return mpctx->hrseek_pts;
double apts = playing_audio_pts(mpctx);
if (apts != MP_NOPTS_VALUE)
return apts;
if (mpctx->sh_video) {
double pts = mpctx->video_pts;
if (pts != MP_NOPTS_VALUE)
return pts;
if (!mpctx->restart_playback) {
double apts = playing_audio_pts(mpctx);
if (apts != MP_NOPTS_VALUE)
return apts;
if (mpctx->sh_video) {
double pts = mpctx->video_pts;
if (pts != MP_NOPTS_VALUE)
return pts;
}
}
if (mpctx->last_seek_pts != MP_NOPTS_VALUE)
return mpctx->last_seek_pts;