[FFmpeg-devel] CrystalHD: Correcting use of h264 parser

Philip Langdale philipl at overt.org
Sun Jun 5 00:18:22 CEST 2011


Hi all,

It's been pointed out on the mplayer list that the way the
CrystalHD decoder uses the h264 parser leads to memory leaks
under certain circumstances. I'd like to get some advice on
how to correct this - there's no direct usage of parsers in
any other decoder so I have no examples to go by. Additionally,
I don't even use the parsed data - just metadata.

Today, I set up the parser in the decoder's init function and
then call it on each decode() call to retrieve the h264 picture
structure information. I then ignore the out buffer and 
pass the original stream to the hardware.

One obvious thought is that I should be explicitly freeing the
out buffer returned by parse2(), but it doesn't look like the
implementation of the parser is allocating anything.

Reimar says I should be using COMPLETE_FRAMES, which has been
discussed before, but my past attempts have lead to the parser
freaking out and not working at all - he then went on to say
that the parser only supports annex b - and as most content
I test with isn't in annex b format, that would explain the
failure. So, it sounds like I would need to run the stream
through the annex b filter and then into the parser to allow
for COMPLETE_FRAMES to work and then the leak should go away?

That sounds like a lot of overhead for a single metadata field.

Is there anything simpler I can do?

Thanks,

--phil


More information about the ffmpeg-devel mailing list