[FFmpeg-devel] [PATCH] examples/muxing: zero AVPacket before av_read_frame()
Hendrik Leppkes
h.leppkes at gmail.com
Tue Jan 28 15:46:39 CET 2014
On Tue, Jan 28, 2014 at 3:38 PM, Andrey Utkin
<andrey.krieger.utkin at gmail.com> wrote:
> av_read_frame() uses AVPacket.buf pointer value, so we must initialize
> it with NULL. It is not documented whether av_read_frame() relies on
> any else initial values of AVPacket fields. So to stay safe, we zero all
> AVPacket memory.
> ---
> doc/examples/remuxing.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/doc/examples/remuxing.c b/doc/examples/remuxing.c
> index e58393b..0a536a8 100644
> --- a/doc/examples/remuxing.c
> +++ b/doc/examples/remuxing.c
> @@ -121,6 +121,7 @@ int main(int argc, char **argv)
> while (1) {
> AVStream *in_stream, *out_stream;
>
> + memset(&pkt, 0, sizeof(pkt));
> ret = av_read_frame(ifmt_ctx, &pkt);
> if (ret < 0)
> break;
> --
> 1.8.1.5
>
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?
- Hendrik
More information about the ffmpeg-devel
mailing list