From bb30232fcdd05af5c0cf9a2819a245fe99dc3538 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Fri, 29 Jul 2011 13:38:09 +0200 Subject: [PATCH] mjpeg: remove wrong g_return_if_fail After calling jpeg_read_scanlines, spice-gtk checks that we read the amount of lines we expected, and if not, it returns early. This is doubly wrong: * jpeg_read_scanlines is documented as returning at most the number of lines requested, but it also warns that an application shouldn't rely on getting exactly the number of scanlines requested. In this case, if rec_outbuf_height is bigger than 1, we'll get a short read on the last line of odd-sized images, thus triggering the g_return_if_fail * returning from this function without calling jpeg_abort will cause libjpeg to abort next time we use it because jpeg_start_decompress was called before This commit removes this check and early return. --- gtk/channel-display-mjpeg.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gtk/channel-display-mjpeg.c b/gtk/channel-display-mjpeg.c index 3789c87..9e8bc0b 100644 --- a/gtk/channel-display-mjpeg.c +++ b/gtk/channel-display-mjpeg.c @@ -116,8 +116,6 @@ void stream_mjpeg_data(display_stream *st) } lines_read = jpeg_read_scanlines(&st->mjpeg_cinfo, lines, st->mjpeg_cinfo.rec_outbuf_height); - // this shouldn't happen either.. - g_return_if_fail(lines_read == st->mjpeg_cinfo.rec_outbuf_height); #ifndef JCS_EXTENSIONS { uint8_t *s = lines[0];