From 904a2864bdafe19d18db95ca54dfb36d72957a16 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 9 Sep 2013 17:36:01 +0200 Subject: [PATCH] avcodec/ffv1enc: fix size used for ff_alloc_packet2() Signed-off-by: Michael Niedermayer --- libavcodec/ffv1enc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 6baa7e97bf..7c1b30a147 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -1015,9 +1015,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t keystate = 128; uint8_t *buf_p; int i, ret; + int64_t maxsize = FF_MIN_BUFFER_SIZE + + avctx->width*avctx->height*35LL*4; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*((8*2+1+1)*4)/8 - + FF_MIN_BUFFER_SIZE)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, maxsize)) < 0) return ret; ff_init_range_encoder(c, pkt->data, pkt->size);