]> rtime.felk.cvut.cz Git - frescor/streamer.git/commitdiff
Set the correct packet size
authorLuca Abeni <luca@nowhere.science.unitn.it>
Wed, 5 Nov 2008 12:52:01 +0000 (13:52 +0100)
committerLuca Abeni <luca@nowhere.science.unitn.it>
Wed, 5 Nov 2008 12:52:01 +0000 (13:52 +0100)
codec.c

diff --git a/codec.c b/codec.c
index 819343aa57d08051d93af230e5fb1b0714e7ad8d..c4be647987a52bb1516012bbc2ae11836a0bb270 100644 (file)
--- 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;
 }