jpegdec: avoid invalid adapter flush on QoS

First store the available data in the adapter in the rem_img_len instance field
before trying to flush the adapter with that value on QoS.
This commit is contained in:
Wim Taymans 2010-09-07 16:49:16 +02:00
parent 2ed53fd77f
commit 2b81f913a4

View file

@ -1203,19 +1203,20 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
goto need_more_data;
}
dec->rem_img_len = img_len;
GST_LOG_OBJECT (dec, "image size = %u", img_len);
/* QoS: if we're too late anyway, skip decoding */
if (dec->packetized && !gst_jpeg_dec_do_qos (dec, timestamp))
goto skip_decoding;
GST_LOG_OBJECT (dec, "image size = %u", img_len);
#ifndef GST_DISABLE_GST_DEBUG
data = (guint8 *) gst_adapter_peek (dec->adapter, 4);
GST_LOG_OBJECT (dec, "reading header %02x %02x %02x %02x", data[0], data[1],
data[2], data[3]);
#endif
dec->rem_img_len = img_len;
gst_jpeg_dec_fill_input_buffer (&dec->cinfo);
if (setjmp (dec->jerr.setjmp_buffer)) {