Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2021-08-16 15:35:23 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-08-16 16:12:19 +0300
commit118946d1953fb4e1bfd978d5ecef3151b98880a1 (patch)
tree802321b1e8d223e1abb67012fa13e8df8ff60a9d /source/blender
parent2946f72a2a1f4afc4967ceda28df4294de304b81 (diff)
Fix T87967: M2T video seeking is broken
Bug caused by integer overflow in ffmpeg_generic_seek_workaround(). Function max_ii() was used to limit int_64tvalue. After fixing the issue there was another issue, where near-infinite loop was caused by requested_pos being very large and stream being cut in a way, that it was missing keyframe at beginning. This was fixed by checking if we are reading beyond file content. Reviewed By: zeddb Differential Revision: https://developer.blender.org/D11888
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/imbuf/intern/anim_movie.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 2998c4781b6..dbca16ca82b 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1213,7 +1213,7 @@ static int ffmpeg_generic_seek_workaround(struct anim *anim,
/* Step backward frame by frame until we find the key frame we are looking for. */
while (current_pts != 0) {
current_pts = *requested_pts - (int64_t)round(offset * steps_per_frame);
- current_pts = max_ii(current_pts, 0);
+ current_pts = MAX2(current_pts, 0);
/* Seek to timestamp. */
if (av_seek_frame(anim->pFormatCtx, anim->videoStream, current_pts, AVSEEK_FLAG_BACKWARD) <
@@ -1243,11 +1243,12 @@ static int ffmpeg_generic_seek_workaround(struct anim *anim,
/* We found the I-frame we were looking for! */
break;
}
- if (cur_pts == prev_pts) {
- /* We got the same key frame packet twice.
- * This probably means that we have hit the beginning of the stream. */
- break;
- }
+ }
+
+ if (cur_pts == prev_pts) {
+ /* We got the same key frame packet twice.
+ * This probably means that we have hit the beginning of the stream. */
+ break;
}
prev_pts = cur_pts;