mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-29 07:06:59 +08: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 from630a2b1. 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 commitc1232c9. 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:
+15
-9
@@ -2872,6 +2872,12 @@ static int seek(MPContext *mpctx, struct seek_params seek,
|
|||||||
} else
|
} else
|
||||||
mpctx->last_seek_pts = MP_NOPTS_VALUE;
|
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) {
|
if (hr_seek || mpctx->timeline) {
|
||||||
mpctx->hrseek_active = true;
|
mpctx->hrseek_active = true;
|
||||||
mpctx->hrseek_framedrop = true;
|
mpctx->hrseek_framedrop = true;
|
||||||
@@ -2958,15 +2964,15 @@ double get_current_time(struct MPContext *mpctx)
|
|||||||
return 0;
|
return 0;
|
||||||
if (demuxer->stream_pts != MP_NOPTS_VALUE)
|
if (demuxer->stream_pts != MP_NOPTS_VALUE)
|
||||||
return demuxer->stream_pts;
|
return demuxer->stream_pts;
|
||||||
if (mpctx->hrseek_active)
|
if (!mpctx->restart_playback) {
|
||||||
return mpctx->hrseek_pts;
|
double apts = playing_audio_pts(mpctx);
|
||||||
double apts = playing_audio_pts(mpctx);
|
if (apts != MP_NOPTS_VALUE)
|
||||||
if (apts != MP_NOPTS_VALUE)
|
return apts;
|
||||||
return apts;
|
if (mpctx->sh_video) {
|
||||||
if (mpctx->sh_video) {
|
double pts = mpctx->video_pts;
|
||||||
double pts = mpctx->video_pts;
|
if (pts != MP_NOPTS_VALUE)
|
||||||
if (pts != MP_NOPTS_VALUE)
|
return pts;
|
||||||
return pts;
|
}
|
||||||
}
|
}
|
||||||
if (mpctx->last_seek_pts != MP_NOPTS_VALUE)
|
if (mpctx->last_seek_pts != MP_NOPTS_VALUE)
|
||||||
return mpctx->last_seek_pts;
|
return mpctx->last_seek_pts;
|
||||||
|
|||||||
Reference in New Issue
Block a user