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.
This commit is contained in:
Richard Antalik 2021-04-01 10:30:22 +02:00
parent a9fc5be5fa
commit 6fe2d6b8c8
1 changed files with 1 additions and 0 deletions

View File

@ -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) {