[FFmpeg-devel] [PATCH] Fix potential infinite discard loop.
Reimar.Doeffinger at gmx.de
Sun Feb 5 15:11:25 CET 2012
On Sat, Feb 04, 2012 at 07:32:25PM -0500, Don Moir wrote:
> file 1 ) http://sms.pangolin.com/temp/bad_seek_os-keyframe_Wiki_feel_stupid.ogv
The file as far as I can tell is broken.
The granule values indicate all frames before the one it ends up
seeking to as non-keyframes.
The reason why it works if you always reset keyframe_seek to 0 is
because the auto-generated index contains that position marked as
keyframe, since that value is based on the VP3 header parser and
not the data from the muxing level.
> I also have not seen a case where setting os->keyframe back to zero
> causes any problem (tested about 40-50 ogg files). It might be that
> it just needs to be put back into the state it was in prior to
> calling ff_seek_frame_binary. don't know.
No, it behaves exactly as intended, since in that case it
knows that a keyframe is around that position it discards
everything up to that keyframe.
The problem is just that the first frame is marked as _not_
being a keyframe.
My personal recommendation is to just give up on Ogg, it is
such an incredibly crappy, badly designed, limited, needlessly
complex and generally broken format. Really like someone on
purpose thought "what would be the worst way to implement it"
on every step.
The alternative is to make read_timestamps parse every single
packet manually and just ignore what the demuxer claims it to
be (though with printing a big fat warning every time it's wrong).
More information about the ffmpeg-devel