[Spice-devel] [PATCH 3/6] spicevmc: do not bound compression on bound length
Frediano Ziglio
fziglio at redhat.com
Tue May 17 10:04:29 UTC 2016
This avoid that on full buffers compression is not attempted
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/spicevmc.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 28535f6..1193e18 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -123,7 +123,7 @@ static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
{
RedVmcPipeItem *msg_item_compressed;
- int bound, compressed_data_count;
+ int compressed_data_count;
if (reds_stream_get_family(state->rcc->stream) == AF_UNIX) {
/* AF_LOCAL - data will not be compressed */
@@ -137,17 +137,12 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
/* Client doesn't has compression cap - data will not be compressed */
return NULL;
}
- bound = LZ4_compressBound(n);
- if (bound == 0 || bound >= BUF_SIZE) {
- /* bound is invalid - data will not be compressed */
- return NULL;
- }
msg_item_compressed = spice_new0(RedVmcPipeItem, 1);
red_pipe_item_init(&msg_item_compressed->base, RED_PIPE_ITEM_TYPE_SPICEVMC_DATA);
compressed_data_count = LZ4_compress_default((char*)&msg_item->buf,
(char*)&msg_item_compressed->buf,
n,
- bound);
+ BUF_SIZE);
if (compressed_data_count > 0) {
msg_item_compressed->type = SPICE_DATA_COMPRESSION_TYPE_LZ4;
--
2.7.4
More information about the Spice-devel
mailing list