X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpegpicture.c;h=2be670cdbc2305c1b19a2778cfd191a6ddd1e680;hb=9d68c0191cdd570ece2c4d006b20230ac08085fe;hp=9811a778b75e7640d6c27c217499c7552b20129e;hpb=08fd6e8e3c8f70e4559bea1595adb5a833b110ea;p=ffmpeg diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 9811a778b75..2be670cdbc2 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -22,6 +22,7 @@ #include "libavutil/avassert.h" #include "libavutil/common.h" +#include "libavutil/pixdesc.h" #include "avcodec.h" #include "motion_est.h" @@ -155,7 +156,8 @@ static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic, return -1; } - if (pic->f->linesize[1] != pic->f->linesize[2]) { + if (av_pix_fmt_count_planes(pic->f->format) > 2 && + pic->f->linesize[1] != pic->f->linesize[2]) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n"); ff_mpeg_unref_picture(avctx, pic); @@ -373,8 +375,10 @@ int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src) if (src->hwaccel_picture_private) { dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf); - if (!dst->hwaccel_priv_buf) + if (!dst->hwaccel_priv_buf) { + ret = AVERROR(ENOMEM); goto fail; + } dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data; }