Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/dcc-encoders.c | 16 ++++++++-------- server/dcc-encoders.h | 5 +++++ server/dcc.c | 4 ++-- server/dcc.h | 4 ---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c index 0b8ef46..8790512 100644 --- a/server/dcc-encoders.c +++ b/server/dcc-encoders.c @@ -373,14 +373,14 @@ static void image_encoders_init_jpeg(ImageEncoders *enc) } #ifdef USE_LZ4 -static inline void dcc_init_lz4(DisplayChannelClient *dcc) +static inline void image_encoders_init_lz4(ImageEncoders *enc) { - dcc->lz4_data.usr.more_space = lz4_usr_more_space; - dcc->lz4_data.usr.more_lines = lz4_usr_more_lines; + enc->lz4_data.usr.more_space = lz4_usr_more_space; + enc->lz4_data.usr.more_lines = lz4_usr_more_lines; - dcc->lz4 = lz4_encoder_create(&dcc->lz4_data.usr); + enc->lz4 = lz4_encoder_create(&enc->lz4_data.usr); - if (!dcc->lz4) { + if (!enc->lz4) { spice_critical("create lz4 encoder failed"); } } @@ -407,7 +407,7 @@ void dcc_encoders_init(DisplayChannelClient *dcc) image_encoders_init_lz(enc); image_encoders_init_jpeg(enc); #ifdef USE_LZ4 - dcc_init_lz4(dcc); + image_encoders_init_lz4(enc); #endif dcc_init_zlib(dcc); @@ -425,8 +425,8 @@ void dcc_encoders_free(DisplayChannelClient *dcc) jpeg_encoder_destroy(enc->jpeg); enc->jpeg = NULL; #ifdef USE_LZ4 - lz4_encoder_destroy(dcc->lz4); - dcc->lz4 = NULL; + lz4_encoder_destroy(enc->lz4); + enc->lz4 = NULL; #endif zlib_encoder_destroy(dcc->zlib); dcc->zlib = NULL; diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 939221f..d540cd3 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -172,6 +172,11 @@ struct ImageEncoders { JpegData jpeg_data; JpegEncoderContext *jpeg; + +#ifdef USE_LZ4 + Lz4Data lz4_data; + Lz4EncoderContext *lz4; +#endif }; typedef struct compress_send_data_t { diff --git a/server/dcc.c b/server/dcc.c index 218baad..c3cfb05 100644 --- a/server/dcc.c +++ b/server/dcc.c @@ -788,8 +788,8 @@ glz: static int dcc_compress_image_lz4(DisplayChannelClient *dcc, SpiceImage *dest, SpiceBitmap *src, compress_send_data_t* o_comp_data) { - Lz4Data *lz4_data = &dcc->lz4_data; - Lz4EncoderContext *lz4 = dcc->lz4; + Lz4Data *lz4_data = &dcc->encoders.lz4_data; + Lz4EncoderContext *lz4 = dcc->encoders.lz4; int lz4_size = 0; stat_start_time_t start_time; stat_start_time_init(&start_time, &DCC_TO_DC(dcc)->lz4_stat); diff --git a/server/dcc.h b/server/dcc.h index 034b9b1..bdfc001 100644 --- a/server/dcc.h +++ b/server/dcc.h @@ -65,10 +65,6 @@ struct DisplayChannelClient { int zlib_level; -#ifdef USE_LZ4 - Lz4Data lz4_data; - Lz4EncoderContext *lz4; -#endif ZlibData zlib_data; ZlibEncoder *zlib; -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel