diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-20 13:21:52 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-20 14:12:54 -0400 |
commit | a1977e0103d23212b842e8398baaf0269891d9e5 (patch) | |
tree | 7f31ef83498b7154d1e75646a2671a8e61090a59 /libavcodec/utils.c | |
parent | 777365fe8602d4b92e2664647d0e5fe2418d4bf6 (diff) | |
download | ffmpeg-a1977e0103d23212b842e8398baaf0269891d9e5.tar.gz |
lavc: shrink encoded audio packet size after encoding.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index fc48f029f6..a638bbfc91 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); |