summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-05-19 09:24:05 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-01 12:53:09 -0500
commit9f643ec0f81c1836ce55319709dd387e27c55d3b (patch)
treef6ca69f720011fb0215794f19faf265ae4a6ab29
parentb05ad290e2a5d9074179fede31d54371e1a09a6a (diff)
downloadhqemu-9f643ec0f81c1836ce55319709dd387e27c55d3b.zip
hqemu-9f643ec0f81c1836ce55319709dd387e27c55d3b.tar.gz
vnc: adjust compression zstream level
Adjust zlib compression level if needed by calling deflateParams. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--vnc-encoding-zlib.c9
-rw-r--r--vnc.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/vnc-encoding-zlib.c b/vnc-encoding-zlib.c
index 6a16a79..29dd1b7 100644
--- a/vnc-encoding-zlib.c
+++ b/vnc-encoding-zlib.c
@@ -83,10 +83,17 @@ static int vnc_zlib_stop(VncState *vs)
return -1;
}
+ vs->zlib_level = vs->tight_compression;
zstream->opaque = vs;
}
- // XXX what to do if tight_compression changed in between?
+ if (vs->tight_compression != vs->zlib_level) {
+ if (deflateParams(zstream, vs->tight_compression,
+ Z_DEFAULT_STRATEGY) != Z_OK) {
+ return -1;
+ }
+ vs->zlib_level = vs->tight_compression;
+ }
// reserve memory in output buffer
buffer_reserve(&vs->output, vs->zlib.offset + 64);
diff --git a/vnc.h b/vnc.h
index 6d92c60..3800687 100644
--- a/vnc.h
+++ b/vnc.h
@@ -178,6 +178,7 @@ struct VncState
Buffer zlib;
Buffer zlib_tmp;
z_stream zlib_stream;
+ int zlib_level;
Notifier mouse_mode_notifier;
OpenPOWER on IntegriCloud