player: cleaner determination of current playback PTS

In particular, this won't overwrite the playback PTS in coverart mode,
which actually fixes relative seeks.
This commit is contained in:
wm4 2016-04-23 17:16:54 +02:00
parent abb3f80998
commit 786f37ae1c
2 changed files with 11 additions and 9 deletions

View File

@ -958,6 +958,17 @@ void run_playloop(struct MPContext *mpctx)
fill_audio_out_buffers(mpctx); fill_audio_out_buffers(mpctx);
write_video(mpctx); write_video(mpctx);
if (mpctx->vo_chain && !mpctx->vo_chain->is_coverart &&
mpctx->video_status >= STATUS_PLAYING &&
mpctx->video_status < STATUS_EOF)
{
mpctx->playback_pts = mpctx->video_pts;
} else if (mpctx->audio_status >= STATUS_PLAYING &&
mpctx->audio_status < STATUS_EOF)
{
mpctx->playback_pts = playing_audio_pts(mpctx);
}
if (mpctx->lavfi) { if (mpctx->lavfi) {
if (lavfi_process(mpctx->lavfi)) if (lavfi_process(mpctx->lavfi))
mpctx->sleeptime = 0; mpctx->sleeptime = 0;
@ -967,14 +978,6 @@ void run_playloop(struct MPContext *mpctx)
handle_playback_restart(mpctx); handle_playback_restart(mpctx);
// Use the audio timestamp if no video, or video is enabled, but has ended.
if (mpctx->video_status == STATUS_EOF &&
mpctx->audio_status >= STATUS_PLAYING &&
mpctx->audio_status < STATUS_EOF)
{
mpctx->playback_pts = playing_audio_pts(mpctx);
}
handle_dummy_ticks(mpctx); handle_dummy_ticks(mpctx);
update_osd_msg(mpctx); update_osd_msg(mpctx);

View File

@ -1380,7 +1380,6 @@ void write_video(struct MPContext *mpctx)
mpctx->video_pts = mpctx->next_frames[0]->pts; mpctx->video_pts = mpctx->next_frames[0]->pts;
mpctx->last_vo_pts = mpctx->video_pts; mpctx->last_vo_pts = mpctx->video_pts;
mpctx->playback_pts = mpctx->video_pts;
shift_frames(mpctx); shift_frames(mpctx);