Commit 905e28a0 authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

jpegdec: Don't pass the same data over and over

We already pass the entire frame to the decoder. If the decoder ask for
more data, don't pass the same data again as this leads to infinit loop.
Instead, simply fail the fill function to signal the problem with that
frame. It will then be skipped properly.
parent f301e3f2
......@@ -183,17 +183,9 @@ gst_jpeg_dec_class_init (GstJpegDecClass * klass)
static boolean
gst_jpeg_dec_fill_input_buffer (j_decompress_ptr cinfo)
GstJpegDec *dec;
dec = CINFO_GET_JPEGDEC (cinfo);
g_return_val_if_fail (dec != NULL, FALSE);
g_return_val_if_fail (dec->current_frame != NULL, FALSE);
g_return_val_if_fail (dec-> != NULL, FALSE);
cinfo->src->next_input_byte = dec->;
cinfo->src->bytes_in_buffer = dec->current_frame_map.size;
return TRUE;
/* We pass in full frame initially, if this get called, the frame is most likely
* corrupted */
return FALSE;
static void
......@@ -1002,7 +994,9 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
dec->current_frame = frame;
gst_buffer_map (frame->input_buffer, &dec->current_frame_map, GST_MAP_READ);
gst_jpeg_dec_fill_input_buffer (&dec->cinfo);
dec->cinfo.src->next_input_byte = dec->;
dec->cinfo.src->bytes_in_buffer = dec->current_frame_map.size;
if (setjmp (dec->jerr.setjmp_buffer)) {
code = dec->;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment