From eb727387fd41d0e6ae2a35a718701f454b940fb6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 1 Mar 2012 12:15:45 +0100 Subject: [PATCH] lavc: shrink encoded video packet size after encoding. Based on a patch by Nicolas George normalesup.org> --- libavcodec/utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2d79f66e35..d797c8a0b7 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++; }