mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
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
This commit is contained in:
parent
f301e3f236
commit
905e28a0f3
1 changed files with 6 additions and 12 deletions
|
@ -183,17 +183,9 @@ gst_jpeg_dec_class_init (GstJpegDecClass * klass)
|
||||||
static boolean
|
static boolean
|
||||||
gst_jpeg_dec_fill_input_buffer (j_decompress_ptr cinfo)
|
gst_jpeg_dec_fill_input_buffer (j_decompress_ptr cinfo)
|
||||||
{
|
{
|
||||||
GstJpegDec *dec;
|
/* We pass in full frame initially, if this get called, the frame is most likely
|
||||||
|
* corrupted */
|
||||||
dec = CINFO_GET_JPEGDEC (cinfo);
|
return FALSE;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1002,7 +994,9 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
|
||||||
|
|
||||||
dec->current_frame = frame;
|
dec->current_frame = frame;
|
||||||
gst_buffer_map (frame->input_buffer, &dec->current_frame_map, GST_MAP_READ);
|
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)) {
|
if (setjmp (dec->jerr.setjmp_buffer)) {
|
||||||
code = dec->jerr.pub.msg_code;
|
code = dec->jerr.pub.msg_code;
|
||||||
|
|
Loading…
Reference in a new issue