With the encode2 API, encoders allocate huge packets to be
sure they have enough room (a typical case is mpeg4, which
allocs ~10M for 1280x768 yuv420p) but only actually use a
very small part of the buffer.
{
int ret;
int user_packet = !!avpkt->data;
+ void *new_data;
*got_packet_ptr = 0;
avpkt->size = 0;
else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
avpkt->pts = avpkt->dts = frame->pts;
+ if (avpkt->data) {
+ new_data = av_realloc(avpkt->data,
+ avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (new_data)
+ avpkt->data = new_data;
+ }
avctx->frame_number++;
}