[FFmpeg-cvslog] lavc: shrink encoded video packet size after encoding.
Anton Khirnov
git at videolan.org
Sat Mar 3 00:38:28 CET 2012
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Mar 1 12:15:45 2012 +0100| [eb727387fd41d0e6ae2a35a718701f454b940fb6] | committer: Anton Khirnov
lavc: shrink encoded video packet size after encoding.
Based on a patch by Nicolas George <nicolas.george <at> normalesup.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb727387fd41d0e6ae2a35a718701f454b940fb6
---
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++;
}
More information about the ffmpeg-cvslog
mailing list