[FFmpeg-devel] [PATCH v2] avcodec/mpegpicture: fix "stride changed" failures in gray mode
Aman Gupta
ffmpeg at tmm1.net
Wed Apr 11 01:53:36 EEST 2018
From: Aman Gupta <aman at tmm1.net>
Before adding uvlinesize check, I was seeing failures decoding
some video with ffmpeg compiled with --enable-gray and using AV_CODEC_FLAG_GRAY.
[mpeg2video @ 0x7fa193818c00] get_buffer() failed (stride changed: linesize=1280/1280 uvlinesize=0/640)
[mpeg2video @ 0x7fa193818c00] get_buffer() failed (stride changed: linesize=1280/1280 uvlinesize=0/640)
---
libavcodec/mpegpicture.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 2be670cdbc..c0e06900fe 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -148,10 +148,12 @@ static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic,
}
}
- if (linesize && (linesize != pic->f->linesize[0] ||
- uvlinesize != pic->f->linesize[1])) {
+ if ((linesize && linesize != pic->f->linesize[0]) ||
+ (uvlinesize && uvlinesize != pic->f->linesize[1])) {
av_log(avctx, AV_LOG_ERROR,
- "get_buffer() failed (stride changed)\n");
+ "get_buffer() failed (stride changed: linesize=%d/%d uvlinesize=%d/%d)\n",
+ linesize, pic->f->linesize[0],
+ uvlinesize, pic->f->linesize[1]);
ff_mpeg_unref_picture(avctx, pic);
return -1;
}
--
2.14.2
More information about the ffmpeg-devel
mailing list