[FFmpeg-devel] [PATCH] oggdec: validate VP8 keyframes

James Almer jamrial at gmail.com
Sat Jan 11 05:06:56 CET 2014

On 10/01/14 1:20 AM, Michael Niedermayer wrote:
> On Thu, Jan 09, 2014 at 11:35:04PM -0300, James Almer wrote:
>> On 09/01/14 10:58 PM, Michael Niedermayer wrote:
>>> On Thu, Jan 09, 2014 at 10:54:04PM -0300, James Almer wrote:
>>>> On 09/01/14 10:37 PM, Ronald S. Bultje wrote:
>>>>> Isn't this duplicate with vp8_parser.c, or in other words, shouldn't we
>>>>> invoke the AVParser if it exists?
>>>>> Ronald
>>>> I thought the vp8 parser was being invoked by setting st->need_parsing? oggparsevp8 
>>>> is doing that currently.
>>>> Nonetheless, the vp8 parser marks I and P frames, but it doesn't seem to set the 
>>>> AV_PKT_FLAG_KEY flag for the packet (That's done by the demuxer).
>>>> I did the same thing we're doing for Theora here, fixing wrongly marked keyframes 
>>>> before sending them to the decoder. It fixed seeking with such broken files for me.
>>> parse_packet() sets the AVPacket keyframe flags from the parser
>> So the parser is not being invoked as is? How to do it, then? And why is it not being 
>> done with Theora as well to avoid calling ogg_validate_keyframe() at all?
> i just wanted to point to wheres its supposed to be set, i dont know
> why or if its not happening

I checked and the ff_vp8_parser AVCodecParser is being invoked by setting st->need_parsing.
We could add "s->key_frame = 1" on I frames like it's being done for VP9, but it didn't 
affect the ogg seeking behavior since it apparently depends on the AV_PKT_FLAG_KEY flag 
being set inside a private structure from the demuxer, which is derived from the granule 
value on video streams and ultimately fixed by ogg_validate_keyframe() if the muxer screwed 

More information about the ffmpeg-devel mailing list