1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavc: shrink encoded audio packet size after encoding.

This commit is contained in:
Justin Ruggles 2012-03-20 13:21:52 -04:00
parent 777365fe86
commit a1977e0103

View File

@ -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);