[FFmpeg-cvslog] lavc: shrink encoded audio packet size after encoding.
Justin Ruggles
git at videolan.org
Wed Mar 21 02:35:03 CET 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Mar 20 13:21:52 2012 -0400| [a1977e0103d23212b842e8398baaf0269891d9e5] | committer: Justin Ruggles
lavc: shrink encoded audio packet size after encoding.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1977e0103d23212b842e8398baaf0269891d9e5
---
libavcodec/utils.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index fc48f02..a638bbf 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -960,8 +960,15 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
if (fs_tmp)
avctx->frame_size = fs_tmp;
}
- if (!ret)
+ if (!ret) {
+ 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++;
+ }
if (ret < 0 || !*got_packet_ptr)
av_free_packet(avpkt);
More information about the ffmpeg-cvslog
mailing list