From 6fe2d6b8c8ebd9566d27b92a890cc4fc1e7d5d1e Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Thu, 1 Apr 2021 10:30:22 +0200 Subject: Fix freezed proxy frames `ffmpeg_generic_seek_workaround()` applied negative offset for seqrched packet timestamp, but proxies always start from 0 and timestamp can be negative. Limit timestamp value to 0, because `av_seek_frame()` doesn't accept negative timestamps and returns with error. This prevents seeking from working correctly. --- source/blender/imbuf/intern/anim_movie.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/imbuf/intern') diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index dc39af803e0..1d14f7567c4 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1140,6 +1140,7 @@ static int ffmpeg_generic_seek_workaround(struct anim *anim, int64_t requested_p * small. */ for (int offset = 5; offset < 25; offset++) { current_pos = requested_pos - ((int64_t)(offset)*AV_TIME_BASE / frame_rate); + current_pos = max_ii(current_pos, 0); /* Seek to timestamp. */ if (av_seek_frame(anim->pFormatCtx, -1, current_pos, AVSEEK_FLAG_BACKWARD) < 0) { -- cgit v1.2.3