diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2016-03-01 13:44:18 +0000 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2016-03-01 13:44:18 +0000 |
commit | 7bcc57ad99381a5aafdb5471ca164e4b6dca7d25 (patch) | |
tree | f81863d4915c78a215e1a94e51c59d19e1514deb /libavcodec/vc2enc.c | |
parent | 41985d40c652b4065848204e42fac6706e15955a (diff) | |
download | ffmpeg-7bcc57ad99381a5aafdb5471ca164e4b6dca7d25.tar.gz |
vc2enc: fix packet underallocation and minimum bitrate with interlacing
This was a regression introduced by commit e7345abe052 which
enabled full use of the allocated packet but due to the overhead of
using field coding the buffer was too small and triggered warnings and
crashes.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/vc2enc.c')
-rw-r--r-- | libavcodec/vc2enc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index 2d875d13d3..868875439d 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -987,7 +987,7 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f); - ret = ff_alloc_packet2(avctx, avpkt, max_frame_bytes*2, 0); + ret = ff_alloc_packet2(avctx, avpkt, max_frame_bytes*3, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; @@ -1197,6 +1197,8 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx) avctx->time_base.den); min_bits_per_frame = minimum_frame_bits(s) + 8*sizeof(LIBAVCODEC_IDENT) + 8*40 + 8*20000; if (bits_per_frame < min_bits_per_frame) { + if (s->interlaced) + min_bits_per_frame += min_bits_per_frame + min_bits_per_frame/2; avctx->bit_rate = av_rescale(min_bits_per_frame, avctx->time_base.den, avctx->time_base.num); av_log(avctx, AV_LOG_WARNING, |