[Spice-devel] [PATCH spice-gtk 1/5] audio: emit stop when the channels are reset

Marc-André Lureau marcandre.lureau at redhat.com
Wed Apr 29 08:06:44 PDT 2015


Ensure a hint is given to the client that the channel is reset.

Unfortunately, since the handle may be asynchronous due to coroutine,
the channel functions should be tolerant to a playback/record calls
functions when the channel is stopped.
---
 gtk/channel-playback.c | 2 ++
 gtk/channel-record.c   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index ae8a75d..9d45e1f 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -172,6 +172,8 @@ static void spice_playback_channel_reset(SpiceChannel *channel, gboolean migrati
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv;
 
     snd_codec_destroy(&c->codec);
+    g_coroutine_signal_emit(channel, signals[SPICE_PLAYBACK_STOP], 0);
+    c->is_active = FALSE;
 
     SPICE_CHANNEL_CLASS(spice_playback_channel_parent_class)->channel_reset(channel, migrating);
 }
diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index ac71999..0b41349 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -169,6 +169,9 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
     g_free(c->last_frame);
     c->last_frame = NULL;
 
+    g_coroutine_signal_emit(channel, signals[SPICE_RECORD_STOP], 0);
+    c->started = FALSE;
+
     snd_codec_destroy(&c->codec);
 
     SPICE_CHANNEL_CLASS(spice_record_channel_parent_class)->channel_reset(channel, migrating);
-- 
2.1.0



More information about the Spice-devel mailing list