[Spice-devel] [PATCH 4/6] spicevmc: avoid to send data not compressible with LZ4

Frediano Ziglio fziglio at redhat.com
Tue May 17 10:04:30 UTC 2016


Send uncompressed instead.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/spicevmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/spicevmc.c b/server/spicevmc.c
index 1193e18..97eb04c 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -144,7 +144,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
                                                  n,
                                                  BUF_SIZE);
 
-    if (compressed_data_count > 0) {
+    if (compressed_data_count > 0 && compressed_data_count < n) {
         msg_item_compressed->type = SPICE_DATA_COMPRESSION_TYPE_LZ4;
         msg_item_compressed->uncompressed_data_size = n;
         msg_item_compressed->buf_used = compressed_data_count;
@@ -152,8 +152,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
         return msg_item_compressed;
     }
 
-    /* LZ4 compression failed-fallback a non-compressed data is to be sent */
-    spice_warning("Compress Error");
+    /* LZ4 compression failed or did non compress, fallback a non-compressed data is to be sent */
     free(msg_item_compressed);
     return NULL;
 }
-- 
2.7.4



More information about the Spice-devel mailing list