player: seek backward for type MPSEEK_FACTOR

Choosing the seek direction for MPSEEK_FACTOR based on the location of
seek_pts is nonsense, and can cause the seek position to oscillate
between adjacent keyframes, such as when dragging the OSC bar on short
videos.

Fix this by always seeking backward for type MPSEEK_FACTOR, i.e. seek
to the keyframe for the group of pictures (GOP) in which seek_pts is
located.

Fixes #4183.

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
jrodatus 2017-06-17 10:18:57 -04:00 committed by wm4
parent 2ba2062e5b
commit ab19b3c9d3
1 changed files with 1 additions and 1 deletions

View File

@ -284,7 +284,7 @@ static void mp_seek(MPContext *mpctx, struct seek_params seek)
double len = get_time_length(mpctx);
if (len >= 0)
seek_pts = seek.amount * len;
demux_flags = seek_pts > current_time ? SEEK_FORWARD : SEEK_BACKWARD;
demux_flags = SEEK_BACKWARD;
break;
default: abort();
}