From 285811e7a758f14d58f0f4382f182553a35d14c0 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Mon, 31 Aug 2020 16:38:48 +0200 Subject: [PATCH] jpegdec: be stricter when detecting interlaced video There are broken(?) mjpeg videos that are incorrectly detected as interlaced. This happens because 'info.height > height' (e.g. 1088 > 1080). In the interlaced case info.height is approximately 'height * 2' but not exactly because height is a multiple of DCTSIZE. Make the check more restrictive but take the rounding effect into account. Part-of: --- subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c b/subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c index 5343081761..a290e952b4 100644 --- a/subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c +++ b/subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c @@ -1406,8 +1406,8 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame) /* is it interlaced MJPEG? (we really don't want to scan the jpeg data * to see if there are two SOF markers in the packet to detect this) */ if (gst_video_decoder_get_packetized (bdec) && - dec->input_state && - dec->input_state->info.height > height && + dec->input_state && height > DCTSIZE && + dec->input_state->info.height > (2 * (height - DCTSIZE)) && dec->input_state->info.height <= (height * 2) && dec->input_state->info.width == width) { GST_LOG_OBJECT (dec,