diff options
author | wm4 <wm4@nowhere> | 2013-02-13 13:22:12 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-02-13 13:22:12 +0100 |
commit | f9a259e5d5a3aa7eb34a7278e549636b5138655d (patch) | |
tree | 9cbe741a2b496bf7a4cfaea2a50ea16404ba1e1e /core/mplayer.c | |
parent | 9e85d2ac134501ecc9fd9819343a1627d2f19ee8 (diff) | |
download | mpv-f9a259e5d5a3aa7eb34a7278e549636b5138655d.tar.bz2 mpv-f9a259e5d5a3aa7eb34a7278e549636b5138655d.tar.xz |
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.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r-- | core/mplayer.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/core/mplayer.c b/core/mplayer.c index dbcebf9f4e..048d7ab3e1 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -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; |