Fix T101981: Incorrect playback of AVI files

Commit bcc56253e2 introduced 3 frame negative offset for seeking. This
can result in negative seek values.

Ensure, that seek value is always positive.
This commit is contained in:
Richard Antalik
2022-10-24 19:40:39 +02:00
parent 5379587772
commit a67876103a

View File

@@ -1100,7 +1100,12 @@ static int64_t ffmpeg_get_seek_pts(struct anim *anim, int64_t pts_to_search)
* experimentally. Note: Too big offset can impact performance. Current 3 frame offset has no
* measurable impact.
*/
return pts_to_search - (ffmpeg_steps_per_frame_get(anim) * 3);
int64_t seek_pts = pts_to_search - (ffmpeg_steps_per_frame_get(anim) * 3);
if (seek_pts < 0) {
seek_pts = 0;
}
return seek_pts;
}
/* This gives us an estimate of which pts our requested frame will have.