[FFmpeg-devel] [PATCH]lavc/mjpegdec: Only set SAR if resolution is available

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Jan 19 00:33:40 CET 2016


Hi!

Attached patch fixes ticket #4479 here.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index b1c5b67..0e95ebd 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1653,7 +1653,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
 
         s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16);
         s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16);
-        ff_set_sar(s->avctx, s->avctx->sample_aspect_ratio);
+        if (s->avctx->width > 0 && s->avctx->height > 0)
+            ff_set_sar(s->avctx, s->avctx->sample_aspect_ratio);
 
         if (s->avctx->debug & FF_DEBUG_PICT_INFO)
             av_log(s->avctx, AV_LOG_INFO,


More information about the ffmpeg-devel mailing list