[Libav-user] Decoding audio: ffmpeg examples

Angelo Haller libav-user at szanni.org
Mon Jan 14 22:05:06 CET 2013


Hello,

I've been looking at the examples on how to use ffmpeg
and I found a few issues.

Fist of all there seems to be a memory leak in
doc/examples/demuxing.c (valgrind certainly tells me that).
Freeing the AVPacket seems to resolve that issue (see the patch
attached). Hope I didn't miss anything here.

Another thing I noticed is that the demuxer example does not call
avcodec_get_frame_defaults() on the frame that it is reusing. Or
does that not really matter? The docs state that you "should"
and not "must".

Then when looking at doc/examples/decoding_encoding.c I noticed
that there is no extra call to avcodec_decode_audio4() when
decoding audio. The docs state that some decoders cache frames.
Is that really true for audio decoding? Line 601 says something about
P and I frames being delayed in the MPEG video decoder...
If so, then I think that some of the audio could go missing in this
example.

Angelo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-examples-demuxing-free-AVPacket-after-usage.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130114/b9458a0e/attachment.bin>


More information about the Libav-user mailing list