Module: libav
Branch: master
Commit: eb727387fd41d0e6ae2a35a718701f454b940fb6

Author:    Anton Khirnov <[email protected]>
Committer: Anton Khirnov <[email protected]>
Date:      Thu Mar  1 12:15:45 2012 +0100

lavc: shrink encoded video packet size after encoding.

Based on a patch by Nicolas George <nicolas.george <at> normalesup.org>

---

 libavcodec/utils.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2d79f66..d797c8a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1113,6 +1113,12 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
         else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
             avpkt->pts = avpkt->dts = frame->pts;
 
+        if (!user_packet && avpkt->data) {
+            uint8_t *new_data = av_realloc(avpkt->data, avpkt->size);
+            if (new_data)
+                avpkt->data = new_data;
+        }
+
         avctx->frame_number++;
     }
 

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to