[FFmpeg-devel] [PATCH] examples/muxing: zero AVPacket before av_read_frame()

Andrey Utkin andrey.krieger.utkin at gmail.com
Tue Jan 28 15:56:22 CET 2014

2014-01-28 Hendrik Leppkes <h.leppkes at gmail.com>:
> All uses of pkt in av_read_frame either call av_init_packet first to
> clear it, or completely overwrite it with another packet.
> I don't see where the input data ever matters?

av_init_packet() description says
 * Note, this does not touch the data and size members, which have to be
 * initialized separately.
So it didn't really prepare uninitialized AVPacket before
av_read_frame(), at last before, when data was stored by `data`
I wrongly assumed that it does not also set `buf`. But as i see in
code, it does set it to NULL.
I'll redo this patch unsing av_init_packet().

Andrey Utkin

More information about the ffmpeg-devel mailing list