From: Luca Abeni Date: Wed, 5 Nov 2008 12:52:01 +0000 (+0100) Subject: Set the correct packet size X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/streamer.git/commitdiff_plain/20cdb665a0b074751786b0b0d423877c58c15a73 Set the correct packet size --- 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; }