[FFmpeg-devel] [PATCH] avcodec/mjpegdec: Continue if a block fails to decode correctly

Mohammad AlSaleh ce.mohammad.alsaleh at gmail.com
Thu Jul 28 01:18:07 EEST 2022


 Don't give up on the whole frame just because a block failed to
 decode correctly.

 Try to continue decoding if the AV_EF_EXPLODE flag is not set.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh at gmail.com>
---
 libavcodec/mjpegdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 816eb1ce5d..edefc35cb3 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1504,7 +1504,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
                                              s->quant_matrixes[s->quant_sindex[i]]) < 0) {
                                 av_log(s->avctx, AV_LOG_ERROR,
                                        "error y=%d x=%d\n", mb_y, mb_x);
-                                return AVERROR_INVALIDDATA;
+                                if (s->avctx->err_recognition & AV_EF_EXPLODE)
+                                    return AVERROR_INVALIDDATA;
                             }
                             if (ptr) {
                                 s->idsp.idct_put(ptr, linesize[c], s->block);
-- 
2.37.1



More information about the ffmpeg-devel mailing list