av_seek_frame() failed to seek to nearest I-frame. This may be problem
with particular file, or bug in FFmpeg. From what I have read this may
be same issue as ticket #1607 on ffmpeg tracker.
When decoding fails for exact PTS, set frame offset to anim->seek_time_offset.
This offset will be substracted from anim->pFormatCtx->start_time.
This is similar to how preseek was substracted from seek position
before rB88604b79b7d1, but such approach would fail to seek to frame 0
because seek position was limited to be at least 0.
Even though anim->preseek is currently unused, I did not want to use
this field for this purpose, because it is exposed to users.
I want to remove it in separate patch (D10644)
I have tested some files I had by hand, and I was quite surprised, that in a lot of them exact PTS is missed. Not by a lot though, so this isn't the same issue but it will cause anim->seek_time_offset to be set which will have impact on performance.
Perhaps ffmpeg_adjust_seek_time_offset() should only set seek_time_offset if it is dealing with any AVInputFormat that doesn't have it's own read_seek() or read_seek2() functions defined as is said in https://trac.ffmpeg.org/ticket/1607
The performance impact depends a lot on file and seek_time_offset value. So in case of very good file it will be hard to notice, but barely workable files would be unworkable anymore
Note to myself: D10644 works correctly with this patch, conflicts are merged on local branch D10644+T86944