[Spice-commits] server/sound.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Apr 19 08:54:33 UTC 2017


 server/sound.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 258c2234babed9d77d44c9e70753985f4f442b0b
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Apr 14 09:02:26 2017 +0200

    playback: Don't lose client connection after migration
    
    Commit 590acf3c556 introduced a regression after migration:
    PlaybackChannel::connection is never set even if a client is connected,
    which means the playback channel is non-functional until a client
    reconnects as all the snd_channel_set_xxx() method checks for a non-NULL
    PlaybackChannel::connection before sending data to the client.
    
    This commit slightly changes the code flow in
    on_new_playback_channel_client()/playback_channel_client_constructed()
    so that PlaybackChannel::connection is set regardless of what
    red_client_during_migrate_at_target() returns. This is what was done
    prior to 590acf3c556.
    
    This resolves https://bugs.freedesktop.org/show_bug.cgi?id=100136
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/sound.c b/server/sound.c
index 275248c9..72dfefbf 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -1010,10 +1010,14 @@ static int snd_desired_audio_mode(bool playback_compression, int frequency,
 static void on_new_playback_channel_client(SndChannel *channel, SndChannelClient *client)
 {
     RedsState *reds = red_channel_get_server(RED_CHANNEL(channel));
+    RedClient *red_client = red_channel_client_get_client(RED_CHANNEL_CLIENT(client));
 
     spice_assert(client);
 
     channel->connection = client;
+    if (red_client_during_migrate_at_target(red_client)) {
+        return;
+    }
     snd_set_command(client, SND_PLAYBACK_MODE_MASK);
     if (client->active) {
         snd_set_command(client, SND_CTRL_MASK);
@@ -1055,7 +1059,6 @@ playback_channel_client_constructed(GObject *object)
 {
     PlaybackChannelClient *playback_client = PLAYBACK_CHANNEL_CLIENT(object);
     RedChannel *red_channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(playback_client));
-    RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(playback_client));
     SndChannel *channel = SND_CHANNEL(red_channel);
 
     G_OBJECT_CLASS(playback_channel_client_parent_class)->constructed(object);
@@ -1083,9 +1086,7 @@ playback_channel_client_constructed(GObject *object)
     spice_debug("playback client %p using mode %s", playback_client,
                 spice_audio_data_mode_to_string(playback_client->mode));
 
-    if (!red_client_during_migrate_at_target(client)) {
-        on_new_playback_channel_client(channel, SND_CHANNEL_CLIENT(playback_client));
-    }
+    on_new_playback_channel_client(channel, SND_CHANNEL_CLIENT(playback_client));
 
     if (channel->active) {
         snd_playback_start(channel);


More information about the Spice-commits mailing list