aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-03-01 12:15:45 +0100
committerAnton Khirnov <anton@khirnov.net>2012-03-01 22:21:35 +0100
commiteb727387fd41d0e6ae2a35a718701f454b940fb6 (patch)
treef35b3f3d8f787575dc407ee66f09d1d8ebbcb8d2 /libavcodec/utils.c
parent0ce4fe482c27abfa7eac503a52fdc50b70ccd871 (diff)
downloadffmpeg-eb727387fd41d0e6ae2a35a718701f454b940fb6.tar.gz
lavc: shrink encoded video packet size after encoding.
Based on a patch by Nicolas George <nicolas.george <at> normalesup.org>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c6
1 files changed, 6 insertions, 0 deletions
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++;
}