[Spice-devel] [spice-gtk PATCH v2 7/7] channel: playback and record sync volume/mute

Victor Toso victortoso at redhat.com
Mon Mar 23 06:26:31 PDT 2015


As soon as playback-start and record-start are handled, sync volume/mute
with guest.
---
 gtk/channel-playback.c | 4 ++++
 gtk/channel-record.c   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index ae8a75d..550346e 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -21,6 +21,7 @@
 #include "spice-common.h"
 #include "spice-channel-priv.h"
 #include "spice-session-priv.h"
+#include "spice-audio-priv.h"
 
 #include "spice-marshal.h"
 
@@ -364,6 +365,8 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
 {
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv;
     SpiceMsgPlaybackStart *start = spice_msg_in_parsed(in);
+    SpiceSession *session = spice_channel_get_session(channel);
+    SpiceChannel *main_channel = spice_session_get_main_channel(session);
 
     CHANNEL_DEBUG(channel, "%s: fmt %d channels %d freq %d time %d", __FUNCTION__,
                   start->format, start->channels, start->frequency, start->time);
@@ -382,6 +385,7 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
     }
     g_coroutine_signal_emit(channel, signals[SPICE_PLAYBACK_START], 0,
                             start->format, start->channels, start->frequency);
+    agent_sync_audio_playback(main_channel);
 }
 
 /* coroutine context */
diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index ac71999..efd9526 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -23,6 +23,7 @@
 
 #include "spice-marshal.h"
 #include "spice-session-priv.h"
+#include "spice-audio-priv.h"
 
 #include "common/snd_codec.h"
 
@@ -397,6 +398,8 @@ static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
 {
     SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(channel)->priv;
     SpiceMsgRecordStart *start = spice_msg_in_parsed(in);
+    SpiceSession *session = spice_channel_get_session(channel);
+    SpiceChannel *main_channel = spice_session_get_main_channel(session);
     int frame_size = SND_CODEC_MAX_FRAME_SIZE;
 
     c->mode = spice_record_desired_mode(channel, start->frequency);
@@ -423,6 +426,7 @@ static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
 
     g_coroutine_signal_emit(channel, signals[SPICE_RECORD_START], 0,
                             start->format, start->channels, start->frequency);
+    agent_sync_audio_record(main_channel);
 }
 
 /* coroutine context */
-- 
2.1.0



More information about the Spice-devel mailing list