Attempt to reduce diff size moving code back where it was. Also reuse scc variable to reduce changes too. --- server/sound.c | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/server/sound.c b/server/sound.c index cf8d504e..4b41f5fb 100644 --- a/server/sound.c +++ b/server/sound.c @@ -1244,6 +1244,33 @@ record_channel_client_finalize(GObject *object) G_OBJECT_CLASS(record_channel_client_parent_class)->finalize(object); } +static gboolean record_channel_client_initable_init(GInitable *initable, + GCancellable *cancellable, + GError **error) +{ + gboolean success; + RecordChannelClient *record_client = RECORD_CHANNEL_CLIENT(initable); + 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); + + success = record_channel_client_parent_initable_iface->init(initable, cancellable, error); + if (!success) { + return FALSE; + } + + if (channel->volume.volume_nchannels) { + snd_set_command(scc, SND_VOLUME_MUTE_MASK); + } + + if (channel->active) { + record_channel_client_start(scc); + } + snd_send(scc); + + return TRUE; +} + static void snd_set_record_peer(RedChannel *red_channel, RedClient *client, RedStream *stream, G_GNUC_UNUSED int migration, RedChannelCapabilities *caps) @@ -1476,7 +1503,7 @@ static gboolean playback_channel_client_initable_init(GInitable *initable, if (channel->active) { playback_channel_client_start(scc); } - snd_send(SND_CHANNEL_CLIENT(initable)); + snd_send(scc); return TRUE; } @@ -1515,33 +1542,6 @@ playback_channel_client_init(PlaybackChannelClient *playback) snd_playback_alloc_frames(playback); } -static gboolean record_channel_client_initable_init(GInitable *initable, - GCancellable *cancellable, - GError **error) -{ - gboolean success; - RecordChannelClient *record_client = RECORD_CHANNEL_CLIENT(initable); - 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); - - success = record_channel_client_parent_initable_iface->init(initable, cancellable, error); - if (!success) { - return FALSE; - } - - if (channel->volume.volume_nchannels) { - snd_set_command(scc, SND_VOLUME_MUTE_MASK); - } - - if (channel->active) { - record_channel_client_start(scc); - } - snd_send(SND_CHANNEL_CLIENT(initable)); - - return TRUE; -} - static void record_channel_client_initable_interface_init(GInitableIface *iface) { record_channel_client_parent_initable_iface = g_type_interface_peek_parent(iface); -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel