[PATCH] server: Don't call snd_channel_get_server() if we don't have a channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
---
 server/sound.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index 4e61986..54891c5 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -255,7 +255,6 @@ static void snd_record_on_message_done(SndChannel *channel)
 
 static int snd_send_data(SndChannel *channel)
 {
-    RedsState *reds = snd_channel_get_server(channel);
     uint32_t n;
 
     if (!channel) {
@@ -266,6 +265,7 @@ static int snd_send_data(SndChannel *channel)
         return TRUE;
     }
 
+    RedsState *reds = snd_channel_get_server(channel);
     for (;;) {
         struct iovec vec[IOV_MAX];
         int vec_size;
@@ -1047,13 +1047,12 @@ SPICE_GNUC_VISIBLE void spice_server_playback_start(SpicePlaybackInstance *sin)
 {
     SndChannel *channel = sin->st->worker.connection;
     PlaybackChannel *playback_channel = SPICE_CONTAINEROF(channel, PlaybackChannel, base);
-    RedsState *reds = snd_channel_get_server(channel);
 
     sin->st->worker.active = 1;
     if (!channel)
         return;
     spice_assert(!playback_channel->base.active);
-    reds_disable_mm_time(reds);
+    reds_disable_mm_time(snd_channel_get_server(channel));
     playback_channel->base.active = TRUE;
     if (!playback_channel->base.client_active) {
         snd_set_command(&playback_channel->base, SND_PLAYBACK_CTRL_MASK);
@@ -1067,13 +1066,12 @@ SPICE_GNUC_VISIBLE void spice_server_playback_stop(SpicePlaybackInstance *sin)
 {
     SndChannel *channel = sin->st->worker.connection;
     PlaybackChannel *playback_channel = SPICE_CONTAINEROF(channel, PlaybackChannel, base);
-    RedsState *reds = snd_channel_get_server(channel);
 
     sin->st->worker.active = 0;
     if (!channel)
         return;
     spice_assert(playback_channel->base.active);
-    reds_enable_mm_time(reds);
+    reds_enable_mm_time(snd_channel_get_server(channel));
     playback_channel->base.active = FALSE;
     if (playback_channel->base.client_active) {
         snd_set_command(&playback_channel->base, SND_PLAYBACK_CTRL_MASK);
@@ -1194,11 +1192,10 @@ static void on_new_playback_channel(SndWorker *worker)
 
 static void snd_playback_cleanup(SndChannel *channel)
 {
-    RedsState *reds = snd_channel_get_server(channel);
     PlaybackChannel *playback_channel = SPICE_CONTAINEROF(channel, PlaybackChannel, base);
 
     if (playback_channel->base.active) {
-        reds_enable_mm_time(reds);
+        reds_enable_mm_time(snd_channel_get_server(channel));
     }
 
     snd_codec_destroy(&playback_channel->codec);
-- 
2.7.0
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]