lavc: shrink encoded video packet size after encoding.

Based on a patch by Nicolas George <nicolas.george <at> normalesup.org>
This commit is contained in:
Anton Khirnov 2012-03-01 12:15:45 +01:00
parent 0ce4fe482c
commit eb727387fd
1 changed files with 6 additions and 0 deletions

View File

@ -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++;
}