[Spice-devel] [PATCH 2/4] sound: Remove on_new_record_channel_client()

Jonathon Jongsma jjongsma at redhat.com
Thu Apr 20 16:31:24 UTC 2017


It is only called from the constructor, so move all of the code into
that function.

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 server/sound.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index c24911f..fb8f5c6 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -1248,19 +1248,6 @@ SPICE_GNUC_VISIBLE void spice_server_set_record_rate(SpiceRecordInstance *sin, u
     snd_set_rate(&sin->st->channel, frequency, SPICE_RECORD_CAP_OPUS);
 }
 
-static void on_new_record_channel_client(SndChannel *channel, SndChannelClient *client)
-{
-    spice_assert(client);
-
-    channel->connection = client;
-    if (channel->volume.volume_nchannels) {
-        snd_set_command(client, SND_VOLUME_MUTE_MASK);
-    }
-    if (client->active) {
-        snd_set_command(client, SND_CTRL_MASK);
-    }
-}
-
 static void
 record_channel_client_finalize(GObject *object)
 {
@@ -1277,10 +1264,18 @@ record_channel_client_constructed(GObject *object)
     RecordChannelClient *record_client = RECORD_CHANNEL_CLIENT(object);
     RedChannel *red_channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(record_client));
     SndChannel *channel = SND_CHANNEL(red_channel);
+    SndChannelClient *scc = SND_CHANNEL_CLIENT(record_client);
 
     G_OBJECT_CLASS(record_channel_client_parent_class)->constructed(object);
 
-    on_new_record_channel_client(channel, SND_CHANNEL_CLIENT(record_client));
+    channel->connection = scc;
+    if (channel->volume.volume_nchannels) {
+        snd_set_command(scc, SND_VOLUME_MUTE_MASK);
+    }
+    if (scc->active) {
+        snd_set_command(scc, SND_CTRL_MASK);
+    }
+
     if (channel->active) {
         snd_record_start(channel);
     }
-- 
2.9.3



More information about the Spice-devel mailing list