From c1232c9a01b7a6ae70fb0f919a4a6ffec986c613 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 15 Dec 2012 16:27:09 +0200 Subject: [PATCH] core: timeline: prevent inaccurate seeks outside timeline Ensure that even if a seek is inaccurate it will not show video from outside the defined timeline. Previously, seeking to the beginning of a segment could show frames from before the start of the segment if the seek was done in inaccurate mode and the demuxer seeked to an earlier position. Now hr-seek machinery is used to skip at least the frames that should not be part of playback timeline at all. --- core/mplayer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/mplayer.c b/core/mplayer.c index 2e445cf81e..008a783d73 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2881,10 +2881,11 @@ static int seek(MPContext *mpctx, struct seek_params seek, } else mpctx->last_seek_pts = MP_NOPTS_VALUE; - if (hr_seek) { + if (hr_seek || mpctx->timeline) { mpctx->hrseek_active = true; mpctx->hrseek_framedrop = true; - mpctx->hrseek_pts = seek.amount; + mpctx->hrseek_pts = hr_seek ? seek.amount + : mpctx->timeline[mpctx->timeline_part].start; } mpctx->start_timestamp = GetTimerMS();