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.
diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx
index 5df0039..c8bf841 100644
--- a/common/rfb/JpegCompressor.cxx
+++ b/common/rfb/JpegCompressor.cxx
@@ -94,7 +94,7 @@
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();