diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-10-24 20:40:39 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-10-24 20:46:42 +0300 |
commit | a67876103a6bb4554317f09ebd57c1997a45ed89 (patch) | |
tree | b33358accfda387ff2d94a0c5b382eb9445fe766 /source/blender/imbuf/intern | |
parent | 53795877727d67185de858a480c8090ca7eb8e36 (diff) |
Fix T101981: Incorrect playback of AVI files
Commit bcc56253e26e introduced 3 frame negative offset for seeking. This
can result in negative seek values.
Ensure, that seek value is always positive.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 71e0d0fe11e..94c0555dcf0 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -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. |