From 20cdb665a0b074751786b0b0d423877c58c15a73 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Wed, 5 Nov 2008 13:52:01 +0100 Subject: [PATCH] Set the correct packet size --- codec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codec.c b/codec.c index 819343a..c4be647 100644 --- a/codec.c +++ b/codec.c @@ -118,8 +118,8 @@ AVPacket *pkt_encode(AVFormatContext *ctx, AVFrame *frame) static AVPacket pkt; int res; + pkt.size = 256 * 1024; if (pkt.data == NULL) { - pkt.size = 256 * 1024; pkt.data = av_malloc(pkt.size); } res = avcodec_encode_video(c, pkt.data, pkt.size, frame); @@ -130,6 +130,7 @@ AVPacket *pkt_encode(AVFormatContext *ctx, AVFrame *frame) return NULL; } + pkt.size = res; return &pkt; } -- 2.39.2