]> source.dussan.org Git - tigervnc.git/commitdiff
Flush entire JPEG buffer, ignoring state
authorPierre Ossman <ossman@cendio.se>
Fri, 16 Oct 2015 11:03:14 +0000 (13:03 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 16 Oct 2015 11:03:14 +0000 (13:03 +0200)
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

index 5df0039ed37b2602e1cfd991647549d401d17fc5..c8bf8410ad4a7f6b7aa3efffd61d7fc8dabd878c 100644 (file)
@@ -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();