[FFmpeg-devel] [PATCH] examples: add remuxing example

Andrey Utkin andrey.krieger.utkin at gmail.com
Sun Jan 26 18:55:00 CET 2014


2014-01-19 Stefano Sabatini <stefasab at gmail.com>:
> +int main(int argc, char **argv)
> +{
> +    AVOutputFormat *ofmt = NULL;
> +    AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
> +    AVPacket pkt;
...
> +    while (1) {
> +        AVStream *in_stream, *out_stream;
> +
> +        ret = av_read_frame(ifmt_ctx, &pkt);

pkt is allocated on stack, and not cleaned before av_read_frame(),
although this function is declared to behave depending on value of
pkt.buf. Although it is hard to find in code what else exactly it uses
in initial state of pkt.
So at last pkt.buf = NULL is needed before each av_read_frame(). Or,
to be sure, memset(pkt, 0, sizeof(pkt)). av_init_packet() is surely
not setting pkt.buf.

Sorry for late review.

-- 
Andrey Utkin


More information about the ffmpeg-devel mailing list