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
This commit is contained in:
Sebastian Parborg 2021-06-14 19:05:29 +02:00 committed by Jeroen Bakker
parent 444a8cbc2f
commit bec8e436a1
Notes: blender-bot 2023-02-14 08:08:56 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
1 changed files with 7 additions and 2 deletions

View File

@ -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;
}