[Spice-commits] server/snd_worker.c

Hans de Goede jwrdegoede at kemper.freedesktop.org
Fri Apr 19 06:50:57 PDT 2013


 server/snd_worker.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 38999db39bd9d03bd37be6fc4acb268c295027d6
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Apr 19 13:57:31 2013 +0200

    snd_worker: Make sure we never send an empty volume message
    
    My commit 71315b2e "snd_worker: Don't send empty audio-volume messages",
    fixes only one case of sending an empty volume message, if the client connects
    to a vm early during its boot sequence, while the snd hardware is being reset
    by the guest driver, qemu will call spice_server_playback_set_volume() with
    0 channels from the reset handler.
    
    This patch also applies both fixes to the record channel.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/server/snd_worker.c b/server/snd_worker.c
index 010c152..2647d87 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -984,7 +984,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_set_volume(SpicePlaybackInstance *
     free(st->volume);
     st->volume = spice_memdup(volume, sizeof(uint16_t) * nchannels);
 
-    if (!channel)
+    if (!channel || nchannels == 0)
         return;
 
     snd_playback_send_volume(playback_channel);
@@ -1222,7 +1222,7 @@ SPICE_GNUC_VISIBLE void spice_server_record_set_volume(SpiceRecordInstance *sin,
     free(st->volume);
     st->volume = spice_memdup(volume, sizeof(uint16_t) * nchannels);
 
-    if (!channel)
+    if (!channel || nchannels == 0)
         return;
 
     snd_record_send_volume(record_channel);
@@ -1321,9 +1321,13 @@ SPICE_GNUC_VISIBLE uint32_t spice_server_record_get_samples(SpiceRecordInstance
 static void on_new_record_channel(SndWorker *worker)
 {
     RecordChannel *record_channel = (RecordChannel *)worker->connection;
+    SpiceRecordState *st = SPICE_CONTAINEROF(worker, SpiceRecordState, worker);
+
     spice_assert(record_channel);
 
-    snd_set_command((SndChannel *)record_channel, SND_RECORD_VOLUME_MASK);
+    if (st->volume.volume_nchannels) {
+        snd_set_command((SndChannel *)record_channel, SND_RECORD_VOLUME_MASK);
+    }
     if (record_channel->base.active) {
         snd_set_command((SndChannel *)record_channel, SND_RECORD_CTRL_MASK);
     }


More information about the Spice-commits mailing list