jpegdec: Call gst_jpeg_turbo_parse_ext_fmt_convert() before jpeg_start_decompress()

It is imperative that the libjpeg-turbo state is properly initialized
before jpeg_start_decompress() is called. Make sure cinfo.out_color_space
and cinfo.raw_data_out are set to their final values matching their peer
caps before calling jpeg_start_decompress().

Fixes: e6d83d8f96 ("jpegdec: Support libjpeg-turbo colorspace conversion")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1687>
This commit is contained in:
Marek Vasut 2022-02-11 23:44:24 +01:00
parent 4ee4a9bff9
commit d277002186

View file

@ -1189,6 +1189,7 @@ gst_jpeg_dec_prepare_decode (GstJpegDec * dec)
dec->cinfo.do_block_smoothing = FALSE;
dec->cinfo.dct_method = dec->idct_method;
#ifdef JCS_EXTENSIONS
gst_jpeg_turbo_parse_ext_fmt_convert (dec, NULL);
if (dec->format_convert) {
dec->cinfo.out_color_space = dec->libjpeg_ext_format;
dec->cinfo.raw_data_out = FALSE;