X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fasvenc.c;h=28f7a94071d0927f4bc93cc5aae16b4a27ca1bf9;hb=92233a63444001477acb70f2afa43a05f10b5fd5;hp=c4eca2a13d6aee1bef02b2d51eb827717ecceb0c;hpb=23ce57af3ad684363881cdd66d5724f40963a65c;p=ffmpeg diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index c4eca2a13d6..28f7a94071d 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -173,10 +173,7 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]) { int i; - if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) < MAX_MB_SIZE) { - av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n"); - return -1; - } + av_assert0(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) >= MAX_MB_SIZE); if (a->avctx->codec_id == AV_CODEC_ID_ASV1) { for (i = 0; i < 6; i++) @@ -231,7 +228,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, clone->format = pict->format; clone->width = FFALIGN(pict->width, 16); clone->height = FFALIGN(pict->height, 16); - ret = av_frame_get_buffer(clone, 32); + ret = av_frame_get_buffer(clone, 0); if (ret < 0) { av_frame_free(&clone); return ret; @@ -298,6 +295,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, while (put_bits_count(&a->pb) & 31) put_bits(&a->pb, 8, 0); + flush_put_bits(&a->pb); size = put_bits_count(&a->pb) / 32; if (avctx->codec_id == AV_CODEC_ID_ASV1) {