From 1e61325deaf01771b661e3fa3fbe658ff6539147 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 16 Oct 2015 13:03:14 +0200 Subject: [PATCH] Flush entire JPEG buffer, ignoring state libjpeg doesn't update the buffer state before calling the empty_output_buffer() callback so we need to flush everything, not just the apparent size. --- common/rfb/JpegCompressor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx index 5df0039e..c8bf8410 100644 --- a/common/rfb/JpegCompressor.cxx +++ b/common/rfb/JpegCompressor.cxx @@ -94,7 +94,7 @@ JpegEmptyOutputBuffer(j_compress_ptr cinfo) JPEG_DEST_MGR *dest = (JPEG_DEST_MGR *)cinfo->dest; JpegCompressor *jc = dest->instance; - jc->setptr(dest->pub.next_output_byte); + jc->setptr(jc->getend()); jc->overrun(jc->getend() - jc->getstart(), 1); dest->pub.next_output_byte = jc->getptr(); dest->pub.free_in_buffer = jc->getend() - jc->getptr(); -- 2.39.5