[Spice-commits] server/sound.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Sat Nov 12 09:56:28 UTC 2016
server/sound.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
New commits:
commit 590acf3c5562e61d357e455e1f38be371da87557
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Fri Nov 11 16:40:40 2016 -0600
Sound: change on_new_*_channel() signatures
Pass the new sound channel to these functions rather than setting
worker->connection before calling the function and expecting it to be
set when the function is called. The fewer unenforced assumptions that
must be true for a function to work properly, the easier it will be to
maintain.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/sound.c b/server/sound.c
index a21eebc..c0e8253 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -1166,13 +1166,13 @@ static int snd_desired_audio_mode(int playback_compression, int frequency,
return SPICE_AUDIO_DATA_MODE_RAW;
}
-static void on_new_playback_channel(SndWorker *worker)
+static void on_new_playback_channel(SndWorker *worker, SndChannel *snd_channel)
{
RedsState *reds = red_channel_get_server(worker->base_channel);
- SndChannel *snd_channel = worker->connection;
spice_assert(snd_channel);
+ worker->connection = snd_channel;
snd_set_command(snd_channel, SND_PLAYBACK_MODE_MASK);
if (snd_channel->active) {
snd_set_command(snd_channel, SND_PLAYBACK_CTRL_MASK);
@@ -1220,7 +1220,6 @@ static void snd_set_playback_peer(RedChannel *channel, RedClient *client, RedsSt
caps, num_caps))) {
return;
}
- worker->connection = &playback_channel->base;
snd_playback_free_frame(playback_channel, &playback_channel->frames[0]);
snd_playback_free_frame(playback_channel, &playback_channel->frames[1]);
snd_playback_free_frame(playback_channel, &playback_channel->frames[2]);
@@ -1243,7 +1242,7 @@ static void snd_set_playback_peer(RedChannel *channel, RedClient *client, RedsSt
}
if (!red_client_during_migrate_at_target(client)) {
- on_new_playback_channel(worker);
+ on_new_playback_channel(worker, &playback_channel->base);
}
if (worker->active) {
@@ -1425,12 +1424,11 @@ SPICE_GNUC_VISIBLE void spice_server_set_record_rate(SpiceRecordInstance *sin, u
red_channel_set_cap(channel, SPICE_RECORD_CAP_OPUS);
}
-static void on_new_record_channel(SndWorker *worker)
+static void on_new_record_channel(SndWorker *worker, SndChannel *snd_channel)
{
- SndChannel *snd_channel = worker->connection;
-
spice_assert(snd_channel);
+ worker->connection = snd_channel ;
if (worker->volume.volume_nchannels) {
snd_set_command(snd_channel, SND_RECORD_VOLUME_MASK);
}
@@ -1472,9 +1470,7 @@ static void snd_set_record_peer(RedChannel *channel, RedClient *client, RedsStre
record_channel->mode = SPICE_AUDIO_DATA_MODE_RAW;
- worker->connection = &record_channel->base;
-
- on_new_record_channel(worker);
+ on_new_record_channel(worker, &record_channel->base);
if (worker->active) {
spice_server_record_start(st->sin);
}
More information about the Spice-commits
mailing list