[Spice-commits] 2 commits - server/dcc-encoders.c server/dcc-encoders.h server/dcc.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed Jun 15 07:24:40 UTC 2016
server/dcc-encoders.c | 9 ++++++++-
server/dcc-encoders.h | 1 -
server/dcc.c | 4 ----
3 files changed, 8 insertions(+), 6 deletions(-)
New commits:
commit 9939496a9310602a65a28961e5dc8eb35270f683
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Mon Jun 6 09:48:07 2016 +0100
Better encoders encapsulation
Avoid to access some fields from dcc.c
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 5160fc5..596d07a 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -645,6 +645,8 @@ gboolean image_encoders_get_glz_dictionary(ImageEncoders *enc,
{
GlzSharedDictionary *shared_dict;
+ spice_return_val_if_fail(!enc->glz_dict, FALSE);
+
pthread_mutex_lock(&glz_dictionary_list_lock);
shared_dict = find_glz_dictionary(client, id);
@@ -678,6 +680,8 @@ gboolean image_encoders_restore_glz_dictionary(ImageEncoders *enc,
{
GlzSharedDictionary *shared_dict = NULL;
+ spice_return_val_if_fail(!enc->glz_dict, FALSE);
+
pthread_mutex_lock(&glz_dictionary_list_lock);
shared_dict = find_glz_dictionary(client, id);
diff --git a/server/dcc.c b/server/dcc.c
index 6396477..48c009d 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -907,7 +907,6 @@ static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init
init->pixmap_cache_size);
spice_return_val_if_fail(dcc->pixmap_cache, FALSE);
- spice_return_val_if_fail(!dcc->encoders.glz_dict, FALSE);
success = image_encoders_get_glz_dictionary(&dcc->encoders,
RED_CHANNEL_CLIENT(dcc)->client,
init->glz_dictionary_id,
@@ -1012,8 +1011,6 @@ int dcc_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void
static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
SpiceMigrateDataDisplay *migrate)
{
- spice_return_val_if_fail(!dcc->encoders.glz_dict, FALSE);
-
return image_encoders_restore_glz_dictionary(&dcc->encoders,
RED_CHANNEL_CLIENT(dcc)->client,
migrate->glz_dict_id,
commit 49273f201196f198e62e5b5e127c528e953c80e2
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Mon Jun 6 09:19:42 2016 +0100
Encapsulate dcc_release_glz
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 4de780d..5160fc5 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -28,6 +28,8 @@
static void image_encoders_free_glz_drawable_instance(ImageEncoders *enc,
GlzDrawableInstanceItem *instance);
+static void image_encoders_release_glz(ImageEncoders *enc);
+
static SPICE_GNUC_NORETURN SPICE_GNUC_PRINTF(2, 3) void
quic_usr_error(QuicUsrContext *usr, const char *fmt, ...)
@@ -422,6 +424,7 @@ void image_encoders_init(ImageEncoders *enc, ImageEncoderSharedData *shared_data
void image_encoders_free(ImageEncoders *enc)
{
+ image_encoders_release_glz(enc);
quic_destroy(enc->quic);
enc->quic = NULL;
lz_destroy(enc->lz);
@@ -698,7 +701,7 @@ gboolean image_encoders_glz_create(ImageEncoders *enc, uint8_t id)
}
/* destroy encoder, and dictionary if no one uses it*/
-void image_encoders_release_glz(ImageEncoders *enc)
+static void image_encoders_release_glz(ImageEncoders *enc)
{
GlzSharedDictionary *shared_dict;
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 655c1b3..bd761a6 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -49,7 +49,6 @@ void image_encoders_free_glz_drawables(ImageEncoders *enc);
void image_encoders_free_glz_drawables_to_free(ImageEncoders* enc);
gboolean image_encoders_glz_create(ImageEncoders *enc, uint8_t id);
void image_encoders_freeze_glz(ImageEncoders *enc);
-void image_encoders_release_glz(ImageEncoders *enc);
#define RED_COMPRESS_BUF_SIZE (1024 * 64)
struct RedCompressBuf {
diff --git a/server/dcc.c b/server/dcc.c
index 41aaf1b..6396477 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -485,7 +485,6 @@ void dcc_stop(DisplayChannelClient *dcc)
pixmap_cache_unref(dcc->pixmap_cache);
dcc->pixmap_cache = NULL;
- image_encoders_release_glz(&dcc->encoders);
dcc_palette_cache_reset(dcc);
free(dcc->send_data.free_list.res);
dcc_destroy_stream_agents(dcc);
More information about the Spice-commits
mailing list