Commit: 47868c8a4ffea0a9a8fe58f5ae69915654db57d3
Author: Richard Antalik
Date:   Mon Oct 24 19:40:39 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB47868c8a4ffea0a9a8fe58f5ae69915654db57d3

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.

===================================================================

M       source/blender/imbuf/intern/anim_movie.c

===================================================================

diff --git a/source/blender/imbuf/intern/anim_movie.c 
b/source/blender/imbuf/intern/anim_movie.c
index f59a96cd564..5c0d31b052a 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1101,7 +1101,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.

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to