summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2016-02-07 15:02:35 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-02-08 10:19:31 -0500
commit905e28a0f35552ae15aeffd4713c9e738218e681 (patch)
tree69a86987c7e0a6a69b1556250963c124d98538a2
parentf301e3f236586756a3f5438a29d3e0713a2b759d (diff)
downloadgstreamer-plugins-good-905e28a0f35552ae15aeffd4713c9e738218e681.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=761670
-rw-r--r--ext/jpeg/gstjpegdec.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index edf616e3d..0ccfca9b5 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -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->current_frame_map.data != NULL, FALSE);
-
- cinfo->src->next_input_byte = dec->current_frame_map.data;
- 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->current_frame_map.data;
+ dec->cinfo.src->bytes_in_buffer = dec->current_frame_map.size;
if (setjmp (dec->jerr.setjmp_buffer)) {
code = dec->jerr.pub.msg_code;