[Spice-devel] [PATCH 1/7] Change playback_compression to bool type

Jonathon Jongsma jjongsma at redhat.com
Fri Apr 7 15:23:55 UTC 2017


This is a setting for determining whether to compress the audio playback
channel or not. It is variously typed as int or uint32_t. Convert it to
a 'bool' to make it more clear that it is a true/false value rather than
an enumeration or something like that.
---
 server/reds.c  | 4 ++--
 server/reds.h  | 2 +-
 server/sound.c | 6 +++---
 server/sound.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 49b0ef0..2a8f905 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -182,7 +182,7 @@ struct RedServerConfig {
     uint32_t streaming_video;
     GArray* video_codecs;
     SpiceImageCompression image_compression;
-    uint32_t playback_compression;
+    bool playback_compression;
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;
 
@@ -593,7 +593,7 @@ static void reds_mig_disconnect(RedsState *reds)
     }
 }
 
-int reds_config_get_playback_compression(RedsState *reds)
+bool reds_config_get_playback_compression(RedsState *reds)
 {
     return reds->config->playback_compression;
 }
diff --git a/server/reds.h b/server/reds.h
index 7466c60..e5f70d5 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -51,7 +51,7 @@ RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id);
 int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
 gboolean reds_config_get_agent_mouse(const RedsState *reds); // used by inputs_channel
 int reds_has_vdagent(RedsState *reds); // used by inputs channel
-int reds_config_get_playback_compression(RedsState *reds); // used by playback channel
+bool reds_config_get_playback_compression(RedsState *reds); // used by playback channel
 
 void reds_handle_agent_mouse_event(RedsState *reds, const VDAgentMouseState *mouse_state); // used by inputs_channel
 
diff --git a/server/sound.c b/server/sound.c
index 75bd0e7..c80716d 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -973,7 +973,7 @@ void snd_set_playback_latency(RedClient *client, uint32_t latency)
     }
 }
 
-static int snd_desired_audio_mode(int playback_compression, int frequency,
+static int snd_desired_audio_mode(bool playback_compression, int frequency,
                                   int client_can_celt, int client_can_opus)
 {
     if (! playback_compression)
@@ -1048,7 +1048,7 @@ playback_channel_client_constructed(GObject *object)
                                           SPICE_PLAYBACK_CAP_CELT_0_5_1);
     int client_can_opus = red_channel_client_test_remote_cap(rcc,
                                           SPICE_PLAYBACK_CAP_OPUS);
-    int playback_compression =
+    bool playback_compression =
         reds_config_get_playback_compression(red_channel_get_server(red_channel));
     int desired_mode = snd_desired_audio_mode(playback_compression, channel->frequency,
                                               client_can_celt, client_can_opus);
@@ -1450,7 +1450,7 @@ void snd_detach_record(SpiceRecordInstance *sin)
     snd_detach_common(&sin->st->channel);
 }
 
-void snd_set_playback_compression(int on)
+void snd_set_playback_compression(bool on)
 {
     SndChannel *now = snd_channels;
 
diff --git a/server/sound.h b/server/sound.h
index f7bcaa6..2f0a2b9 100644
--- a/server/sound.h
+++ b/server/sound.h
@@ -28,7 +28,7 @@ void snd_detach_playback(SpicePlaybackInstance *sin);
 void snd_attach_record(RedsState *reds, SpiceRecordInstance *sin);
 void snd_detach_record(SpiceRecordInstance *sin);
 
-void snd_set_playback_compression(int on);
+void snd_set_playback_compression(bool on);
 
 void snd_set_playback_latency(struct RedClient *client, uint32_t latency);
 
-- 
2.9.3



More information about the Spice-devel mailing list