diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2021-06-14 20:05:29 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-06-30 10:41:44 +0300 |
commit | bec8e436a1cd2d5bcb354b984121765560172548 (patch) | |
tree | c019508bd4c6a4f421b2248f1717c391534eeb1b | |
parent | 444a8cbc2fd99f9311162a14d5309e7d87621afd (diff) |
Fix: VSE seeking with proxy strips would fail on certain frames
If the last decoded frame had the same timestamp as the GOP current
packet, then we would skip over this frame when fast forwarding and we
would seek until the end of the file.
This would could only be triggered reliably in single threaded mode.
Reviewed By: Richard Antalik
Differential Revision: http://developer.blender.org/D11601
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c63ef14dc02..21d9d739d4e 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1290,11 +1290,16 @@ static int ffmpeg_seek_to_key_frame(struct anim *anim, if (same_gop && position > anim->cur_position) { /* Change back to our old frame position so we can simply continue decoding from there. */ + int64_t cur_pts = timestamp_from_pts_or_dts(anim->cur_packet->pts, anim->cur_packet->dts); + + if (cur_pts == gop_pts) { + /* We are already at the correct position. */ + return 0; + } AVPacket *temp = av_packet_alloc(); + while (av_read_frame(anim->pFormatCtx, temp) >= 0) { int64_t temp_pts = timestamp_from_pts_or_dts(temp->pts, temp->dts); - int64_t cur_pts = timestamp_from_pts_or_dts(anim->cur_packet->pts, - anim->cur_packet->dts); if (temp->stream_index == anim->videoStream && temp_pts == cur_pts) { break; } |