[FFmpeg-devel] [PATCH] examples/muxing: zero AVPacket before av_read_frame()
Andrey Utkin
andrey.krieger.utkin at gmail.com
Tue Jan 28 15:38:33 CET 2014
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
More information about the ffmpeg-devel
mailing list