[PATCH spice-gtk] channel-playback/record: Refuse audio-vol-msgs with 0 channels

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

 



Older servers send these, explicitly warn about this, rather then triggering
the following error later:

(remote-viewer:8726): GSpice-WARNING **: set_sink_input_volume() failed: Invalid argument

Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
 gtk/channel-playback.c | 5 +++++
 gtk/channel-record.c   | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index 2d542a7..5aa8454 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -459,6 +459,11 @@ static void playback_handle_set_volume(SpiceChannel *channel, SpiceMsgIn *in)
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv;
     SpiceMsgAudioVolume *vol = spice_msg_in_parsed(in);
 
+    if (vol->nchannels == 0) {
+        g_warning("spice-server send audio-volume-msg with 0 channels");
+        return;
+    }
+
     g_free(c->volume);
     c->nchannels = vol->nchannels;
     c->volume = g_new(guint16, c->nchannels);
diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index 98a36b6..6345569 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -499,6 +499,11 @@ static void record_handle_set_volume(SpiceChannel *channel, SpiceMsgIn *in)
     SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(channel)->priv;
     SpiceMsgAudioVolume *vol = spice_msg_in_parsed(in);
 
+    if (vol->nchannels == 0) {
+        g_warning("spice-server send audio-volume-msg with 0 channels");
+        return;
+    }
+
     g_free(c->volume);
     c->nchannels = vol->nchannels;
     c->volume = g_new(guint16, c->nchannels);
-- 
1.8.1.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]