From 9fe873bec8b6d342064cf282b0ba09f91ac9292f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 27 Jul 2015 20:01:59 +0200 Subject: [PATCH] avcodec/utils: do not use internal->byte_buffer when little downsizing is expected Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b147559aba..42d509e01a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1789,7 +1789,7 @@ int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64 return AVERROR(EINVAL); } - if (avctx) { + if (avctx && 2*min_size < size) { // FIXME The factor needs to be finetuned av_assert0(!avpkt->data || avpkt->data != avctx->internal->byte_buffer); if (!avpkt->data || avpkt->size < size) { av_fast_padded_malloc(&avctx->internal->byte_buffer, &avctx->internal->byte_buffer_size, size);