[Spice-devel,(stable)] sound: do not change volume or mute state on migration

Submitted by Victor Toso on Feb. 27, 2017, 3:13 p.m.

Details

Message ID 20170227151308.17209-2-victortoso@redhat.com
State New
Headers show
Series "sound: do not change volume or mute state on migration" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso Feb. 27, 2017, 3:13 p.m.
From: Victor Toso <me@victortoso.com>

On migration, we are resending the current volume and mute state in
the Guest. If the client user has change its master volume in the
guest it might change the client application volume too and the volume
jump (increase or decrease) might happen on migration.

This patch is a complement of f10de4bc084fcc - Here, volume was
jumping regardless of guest's volume value.

Resolves: rhbz#1425443
Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 server/snd_worker.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/server/snd_worker.c b/server/snd_worker.c
index 1b9bad5..343a69e 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -560,6 +560,12 @@  static int snd_send_volume(SndChannel *channel, SpiceVolumeState *st, int msg)
     SpiceMsgAudioVolume *vol;
     uint8_t c;
 
+    /* Never changes volume or mute state on migration */
+    if (red_client_during_migrate_at_target(channel->channel_client->client)) {
+        spice_debug("Do not change volume during migration");
+        return FALSE;
+    }
+
     vol = alloca(sizeof (SpiceMsgAudioVolume) +
                  st->volume_nchannels * sizeof (uint16_t));
     if (!snd_reset_send_data(channel, msg)) {
@@ -591,6 +597,12 @@  static int snd_send_mute(SndChannel *channel, SpiceVolumeState *st, int msg)
 {
     SpiceMsgAudioMute mute;
 
+    /* Never changes volume or mute state on migration */
+    if (red_client_during_migrate_at_target(channel->channel_client->client)) {
+        spice_debug("Do not change mute during migration");
+        return FALSE;
+    }
+
     if (!snd_reset_send_data(channel, msg)) {
         return FALSE;
     }