summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-04-19 13:57:31 +0200
committerHans de Goede <hdegoede@redhat.com>2013-04-19 13:57:31 +0200
commit38999db39bd9d03bd37be6fc4acb268c295027d6 (patch)
tree518e33f0af0c3d843f3340a2f7594df52d40a4b5 /server
parentbde9387804a75ea45e5d67ff382bfa05c3fc8f49 (diff)
downloadspice-38999db39bd9d03bd37be6fc4acb268c295027d6.tar.gz
spice-38999db39bd9d03bd37be6fc4acb268c295027d6.tar.xz
spice-38999db39bd9d03bd37be6fc4acb268c295027d6.zip
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@redhat.com>
Diffstat (limited to 'server')
-rw-r--r--server/snd_worker.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 010c1527..2647d878 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);
}