[Spice-commits] 5 commits - gtk/channel-main.c gtk/spice-audio.c gtk/spice-audio.h gtk/spice-audio-priv.h gtk/spice-gstaudio.c gtk/spice-pulse.c gtk/spice-session-priv.h spice-common

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Fri Apr 24 08:28:59 PDT 2015


 gtk/channel-main.c       |  132 ++++++++++++
 gtk/spice-audio-priv.h   |    8 
 gtk/spice-audio.c        |   42 ++++
 gtk/spice-audio.h        |   28 ++
 gtk/spice-gstaudio.c     |  195 ++++++++++++++++++
 gtk/spice-pulse.c        |  489 ++++++++++++++++++++++++++++++++++++++++++++++-
 gtk/spice-session-priv.h |    2 
 spice-common             |    2 
 8 files changed, 884 insertions(+), 14 deletions(-)

New commits:
commit 8c50e1a2b9f243a7da9b538cc1438b6a9d8e5671
Author: Victor Toso <victortoso at redhat.com>
Date:   Fri Mar 6 19:03:28 2015 +0100

    agent: sync guest audio with client values
    
    Functions to sync volume and mute value when necessary. In this patch,
    only one sync is allowed after agent connect.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1012868

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 82169aa..c55d097 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -30,6 +30,7 @@
 #include "spice-util-priv.h"
 #include "spice-channel-priv.h"
 #include "spice-session-priv.h"
+#include "spice-audio-priv.h"
 
 /**
  * SECTION:channel-main
@@ -109,6 +110,10 @@ struct _SpiceMainChannelPrivate  {
     guint                       migrate_delayed_id;
     spice_migrate               *migrate_data;
     int                         max_clipboard;
+
+    gboolean                    agent_volume_playback_sync;
+    gboolean                    agent_volume_record_sync;
+    GCancellable                *cancellable_volume_info;
 };
 
 struct spice_migrate {
@@ -187,6 +192,7 @@ static const char *agent_msg_types[] = {
     [ VD_AGENT_CLIPBOARD_GRAB          ] = "clipboard grab",
     [ VD_AGENT_CLIPBOARD_REQUEST       ] = "clipboard request",
     [ VD_AGENT_CLIPBOARD_RELEASE       ] = "clipboard release",
+    [ VD_AGENT_AUDIO_VOLUME_SYNC       ] = "volume-sync",
 };
 
 static const char *agent_caps[] = {
@@ -201,6 +207,7 @@ static const char *agent_caps[] = {
     [ VD_AGENT_CAP_GUEST_LINEEND_LF    ] = "line-end lf",
     [ VD_AGENT_CAP_GUEST_LINEEND_CRLF  ] = "line-end crlf",
     [ VD_AGENT_CAP_MAX_CLIPBOARD       ] = "max-clipboard",
+    [ VD_AGENT_CAP_AUDIO_VOLUME_SYNC   ] = "volume-sync",
 };
 #define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) ? (_a[(_i)] ?: "?") : "?")
 
@@ -231,6 +238,7 @@ static void spice_main_channel_init(SpiceMainChannel *channel)
     c = channel->priv = SPICE_MAIN_CHANNEL_GET_PRIVATE(channel);
     c->agent_msg_queue = g_queue_new();
     c->file_xfer_tasks = g_hash_table_new(g_direct_hash, g_direct_equal);
+    c->cancellable_volume_info = g_cancellable_new();
 
     spice_main_channel_reset_capabilties(SPICE_CHANNEL(channel));
 }
@@ -346,6 +354,9 @@ static void spice_main_channel_dispose(GObject *obj)
         c->migrate_delayed_id = 0;
     }
 
+    g_cancellable_cancel(c->cancellable_volume_info);
+    g_clear_object(&c->cancellable_volume_info);
+
     if (G_OBJECT_CLASS(spice_main_channel_parent_class)->dispose)
         G_OBJECT_CLASS(spice_main_channel_parent_class)->dispose(obj);
 }
@@ -413,6 +424,9 @@ static void spice_main_channel_reset(SpiceChannel *channel, gboolean migrating)
     agent_free_msg_queue(SPICE_MAIN_CHANNEL(channel));
     c->agent_msg_queue = g_queue_new();
 
+    c->agent_volume_playback_sync = FALSE;
+    c->agent_volume_record_sync = FALSE;
+
     set_agent_connected(SPICE_MAIN_CHANNEL(channel), FALSE);
 
     SPICE_CHANNEL_CLASS(spice_main_channel_parent_class)->channel_reset(channel, migrating);
@@ -1092,6 +1106,119 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
     return TRUE;
 }
 
+static void audio_playback_volume_info_cb(GObject *object, GAsyncResult *res, gpointer user_data)
+{
+    SpiceMainChannel *main_channel = user_data;
+    SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel));
+    SpiceAudio *audio = spice_audio_get(session, NULL);
+    VDAgentAudioVolumeSync *avs;
+    guint16 *volume;
+    guint8 nchannels;
+    gboolean mute, ret;
+    gsize array_size;
+    GError *error = NULL;
+
+    ret = spice_audio_get_playback_volume_info_finish(audio, res, &mute, &nchannels,
+                                                      &volume, &error);
+    if (ret == FALSE || volume == NULL || nchannels == 0) {
+        if (error != NULL) {
+            spice_warning("Failed to get playback async volume info: %s", error->message);
+            g_error_free (error);
+        } else {
+            SPICE_DEBUG("Failed to get playback async volume info");
+        }
+        main_channel->priv->agent_volume_playback_sync = FALSE;
+        return;
+    }
+
+    array_size = sizeof(uint16_t) * nchannels;
+    avs = g_malloc0(sizeof(VDAgentAudioVolumeSync) + array_size);
+    avs->is_playback = TRUE;
+    avs->mute = mute;
+    avs->nchannels = nchannels;
+    memcpy(avs->volume, volume, array_size);
+
+    SPICE_DEBUG("%s mute=%s nchannels=%u volume[0]=%u",
+                __func__, spice_yes_no(mute), nchannels, volume[0]);
+    g_free(volume);
+    agent_msg_queue(main_channel, VD_AGENT_AUDIO_VOLUME_SYNC,
+                    sizeof(VDAgentAudioVolumeSync) + array_size, avs);
+}
+
+static void agent_sync_audio_playback(SpiceMainChannel *main_channel)
+{
+    SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel));
+    SpiceAudio *audio = spice_audio_get(session, NULL);
+    SpiceMainChannelPrivate *c = main_channel->priv;
+
+    if (!test_agent_cap(main_channel, VD_AGENT_CAP_AUDIO_VOLUME_SYNC) ||
+        c->agent_volume_playback_sync == TRUE) {
+        SPICE_DEBUG("%s - is not going to sync audio with guest", __func__);
+        return;
+    }
+    /* only one per connection */
+    g_cancellable_reset(c->cancellable_volume_info);
+    c->agent_volume_playback_sync = TRUE;
+    spice_audio_get_playback_volume_info_async(audio, c->cancellable_volume_info, main_channel,
+                                               audio_playback_volume_info_cb, main_channel);
+}
+
+static void audio_record_volume_info_cb(GObject *object, GAsyncResult *res, gpointer user_data)
+{
+    SpiceMainChannel *main_channel = user_data;
+    SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel));
+    SpiceAudio *audio = spice_audio_get(session, NULL);
+    VDAgentAudioVolumeSync *avs;
+    guint16 *volume;
+    guint8 nchannels;
+    gboolean ret, mute;
+    gsize array_size;
+    GError *error = NULL;
+
+    ret = spice_audio_get_record_volume_info_finish(audio, res, &mute, &nchannels, &volume, &error);
+    if (ret == FALSE || volume == NULL || nchannels == 0) {
+        if (error != NULL) {
+            spice_warning ("Failed to get record async volume info: %s", error->message);
+            g_error_free (error);
+        } else {
+            SPICE_DEBUG("Failed to get record async volume info");
+        }
+        main_channel->priv->agent_volume_record_sync = FALSE;
+        return;
+    }
+
+    array_size = sizeof(uint16_t) * nchannels;
+    avs = g_malloc0(sizeof(VDAgentAudioVolumeSync) + array_size);
+    avs->is_playback = FALSE;
+    avs->mute = mute;
+    avs->nchannels = nchannels;
+    memcpy(avs->volume, volume, array_size);
+
+    SPICE_DEBUG("%s mute=%s nchannels=%u volume[0]=%u",
+                __func__, spice_yes_no(mute), nchannels, volume[0]);
+    g_free(volume);
+    agent_msg_queue(main_channel, VD_AGENT_AUDIO_VOLUME_SYNC,
+                    sizeof(VDAgentAudioVolumeSync) + array_size, avs);
+}
+
+static void agent_sync_audio_record(SpiceMainChannel *main_channel)
+{
+    SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel));
+    SpiceAudio *audio = spice_audio_get(session, NULL);
+    SpiceMainChannelPrivate *c = main_channel->priv;
+
+    if (!test_agent_cap(main_channel, VD_AGENT_CAP_AUDIO_VOLUME_SYNC) ||
+        c->agent_volume_record_sync == TRUE) {
+        SPICE_DEBUG("%s - is not going to sync audio with guest", __func__);
+        return;
+    }
+    /* only one per connection */
+    g_cancellable_reset(c->cancellable_volume_info);
+    c->agent_volume_record_sync = TRUE;
+    spice_audio_get_record_volume_info_async(audio, c->cancellable_volume_info, main_channel,
+                                             audio_record_volume_info_cb, main_channel);
+}
+
 /* any context: the message is not flushed immediately,
    you can wakeup() the channel coroutine or send_msg_queue() */
 static void agent_display_config(SpiceMainChannel *channel)
@@ -1345,6 +1472,8 @@ static void agent_start(SpiceMainChannel *channel)
     };
     SpiceMsgOut *out;
 
+    c->agent_volume_playback_sync = FALSE;
+    c->agent_volume_record_sync = FALSE;
     c->agent_caps_received = false;
     set_agent_connected(channel, TRUE);
 
@@ -1801,6 +1930,9 @@ static void main_agent_handle_msg(SpiceChannel *channel,
             c->agent_display_config_sent = true;
         }
 
+        agent_sync_audio_playback(self);
+        agent_sync_audio_record(self);
+
         agent_max_clipboard(self);
 
         agent_send_msg_queue(self);
diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h
index 46938ff..049973a 100644
--- a/gtk/spice-session-priv.h
+++ b/gtk/spice-session-priv.h
@@ -98,7 +98,7 @@ PhodavServer* channel_webdav_server_new(SpiceSession *session);
 guint spice_session_get_n_display_channels(SpiceSession *session);
 void spice_session_set_main_channel(SpiceSession *session, SpiceChannel *channel);
 gboolean spice_session_set_migration_session(SpiceSession *session, SpiceSession *mig_session);
-
+SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context);
 G_END_DECLS
 
 #endif /* __SPICE_CLIENT_SESSION_PRIV_H__ */
commit aa8d044417bbf60685f59163b874ecb4f157c3c9
Author: Victor Toso <victortoso at redhat.com>
Date:   Fri Mar 20 15:01:30 2015 +0100

    audio: spice-gstaudio implements async volume-info
    
    Gstaudio rely on sink/src elements to get the volume/mute.
    (e.g. pulsesink and pulsesrc, the values are updated by PulseAudio
    itself when requested)

diff --git a/gtk/spice-gstaudio.c b/gtk/spice-gstaudio.c
index 892028c..936aa5b 100644
--- a/gtk/spice-gstaudio.c
+++ b/gtk/spice-gstaudio.c
@@ -50,6 +50,16 @@ struct _SpiceGstaudioPrivate {
 
 static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel);
 static void channel_weak_notified(gpointer data, GObject *where_the_object_was);
+static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
+        GCancellable *cancellable, SpiceMainChannel *main_channel,
+        GAsyncReadyCallback callback, gpointer user_data);
+static gboolean spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio,
+        GAsyncResult *res, gboolean *mute, guint8 *nchannels, guint16 **volume, GError **error);
+static void spice_gstaudio_get_record_volume_info_async(SpiceAudio *audio,
+        GCancellable *cancellable, SpiceMainChannel *main_channel,
+        GAsyncReadyCallback callback, gpointer user_data);
+static gboolean spice_gstaudio_get_record_volume_info_finish(SpiceAudio *audio,
+        GAsyncResult *res, gboolean *mute, guint8 *nchannels, guint16 **volume, GError **error);
 
 static void spice_gstaudio_finalize(GObject *obj)
 {
@@ -108,6 +118,10 @@ static void spice_gstaudio_class_init(SpiceGstaudioClass *klass)
     SpiceAudioClass *audio_class = SPICE_AUDIO_CLASS(klass);
 
     audio_class->connect_channel = connect_channel;
+    audio_class->get_playback_volume_info_async = spice_gstaudio_get_playback_volume_info_async;
+    audio_class->get_playback_volume_info_finish = spice_gstaudio_get_playback_volume_info_finish;
+    audio_class->get_record_volume_info_async = spice_gstaudio_get_record_volume_info_async;
+    audio_class->get_record_volume_info_finish = spice_gstaudio_get_record_volume_info_finish;
 
     gobject_class->finalize = spice_gstaudio_finalize;
     gobject_class->dispose = spice_gstaudio_dispose;
@@ -370,6 +384,7 @@ static void playback_volume_changed(GObject *object, GParamSpec *pspec, gpointer
     g_return_if_fail(nchannels > 0);
 
     vol = 1.0 * volume[0] / VOLUME_NORMAL;
+    SPICE_DEBUG("playback volume changed to %u (%0.2f)", volume[0], 100*vol);
 
     if (GST_IS_BIN(p->playback.sink))
         e = gst_bin_get_by_interface(GST_BIN(p->playback.sink), GST_TYPE_STREAM_VOLUME);
@@ -395,7 +410,7 @@ static void playback_mute_changed(GObject *object, GParamSpec *pspec, gpointer d
         return;
 
     g_object_get(object, "mute", &mute, NULL);
-    SPICE_DEBUG("playback mute changed %u", mute);
+    SPICE_DEBUG("playback mute changed to %u", mute);
 
     if (GST_IS_BIN(p->playback.sink))
         e = gst_bin_get_by_interface(GST_BIN(p->playback.sink), GST_TYPE_STREAM_VOLUME);
@@ -428,6 +443,7 @@ static void record_volume_changed(GObject *object, GParamSpec *pspec, gpointer d
     g_return_if_fail(nchannels > 0);
 
     vol = 1.0 * volume[0] / VOLUME_NORMAL;
+    SPICE_DEBUG("record volume changed to %u (%0.2f)", volume[0], 100*vol);
 
     /* TODO directsoundsrc doesn't support IDirectSoundBuffer_SetVolume */
     /* TODO pulsesrc doesn't support volume property, it's all coming! */
@@ -456,6 +472,7 @@ static void record_mute_changed(GObject *object, GParamSpec *pspec, gpointer dat
         return;
 
     g_object_get(object, "mute", &mute, NULL);
+    SPICE_DEBUG("record mute changed to %u", mute);
 
     if (GST_IS_BIN(p->record.src))
         e = gst_bin_get_by_interface(GST_BIN(p->record.src), GST_TYPE_STREAM_VOLUME);
@@ -543,3 +560,179 @@ SpiceGstaudio *spice_gstaudio_new(SpiceSession *session, GMainContext *context,
 
     return gstaudio;
 }
+
+static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
+                                                          GCancellable *cancellable,
+                                                          SpiceMainChannel *main_channel,
+                                                          GAsyncReadyCallback callback,
+                                                          gpointer user_data)
+{
+    GSimpleAsyncResult *simple;
+
+    simple = g_simple_async_result_new(G_OBJECT(audio),
+                                       callback,
+                                       user_data,
+                                       spice_gstaudio_get_playback_volume_info_async);
+    g_simple_async_result_set_check_cancellable (simple, cancellable);
+
+    g_simple_async_result_set_op_res_gboolean(simple, TRUE);
+    g_simple_async_result_complete_in_idle(simple);
+}
+
+static gboolean spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio,
+                                                               GAsyncResult *res,
+                                                               gboolean *mute,
+                                                               guint8 *nchannels,
+                                                               guint16 **volume,
+                                                               GError **error)
+{
+    SpiceGstaudioPrivate *p = SPICE_GSTAUDIO(audio)->priv;
+    GstElement *e;
+    gboolean lmute;
+    gdouble vol;
+    gboolean fake_channel = FALSE;
+    GSimpleAsyncResult *simple = (GSimpleAsyncResult *) res;
+
+    g_return_val_if_fail(g_simple_async_result_is_valid(res,
+        G_OBJECT(audio), spice_gstaudio_get_playback_volume_info_async), FALSE);
+
+    if (g_simple_async_result_propagate_error(simple, error)) {
+        return FALSE;
+    }
+
+    if (p->playback.sink == NULL || p->playback.channels == 0) {
+        SPICE_DEBUG("PlaybackChannel not created yet, force start");
+        /* In order to get system volume, we start the pipeline */
+        playback_start(NULL, SPICE_AUDIO_FMT_S16, 2, 48000, audio);
+        fake_channel = TRUE;
+    }
+
+    if (GST_IS_BIN(p->playback.sink))
+        e = gst_bin_get_by_interface(GST_BIN(p->playback.sink), GST_TYPE_STREAM_VOLUME);
+    else
+        e = g_object_ref(p->playback.sink);
+
+    if (GST_IS_STREAM_VOLUME(e)) {
+        vol = gst_stream_volume_get_volume(GST_STREAM_VOLUME(e), GST_STREAM_VOLUME_FORMAT_CUBIC);
+        lmute = gst_stream_volume_get_mute(GST_STREAM_VOLUME(e));
+    } else {
+        g_object_get(e,
+                     "volume", &vol,
+                     "mute", &lmute, NULL);
+    }
+    g_object_unref(e);
+
+    if (fake_channel) {
+        SPICE_DEBUG("Stop faked PlaybackChannel");
+        playback_stop(NULL, audio);
+    }
+
+    if (mute != NULL) {
+        *mute = lmute;
+    }
+
+    if (nchannels != NULL) {
+        *nchannels = p->playback.channels;
+    }
+
+    if (volume != NULL) {
+        gint i;
+        *volume = g_new(guint16, p->playback.channels);
+        for (i = 0; i < p->playback.channels; i++) {
+            (*volume)[i] = (guint16) (vol * VOLUME_NORMAL);
+            SPICE_DEBUG("(playback) volume at %d is %u (%0.2f%%)", i, (*volume)[i], 100*vol);
+        }
+    }
+
+    return g_simple_async_result_get_op_res_gboolean(simple);
+}
+
+static void spice_gstaudio_get_record_volume_info_async(SpiceAudio *audio,
+                                                        GCancellable *cancellable,
+                                                        SpiceMainChannel *main_channel,
+                                                        GAsyncReadyCallback callback,
+                                                        gpointer user_data)
+{
+    GSimpleAsyncResult *simple;
+
+    simple = g_simple_async_result_new(G_OBJECT(audio),
+                                       callback,
+                                       user_data,
+                                       spice_gstaudio_get_record_volume_info_async);
+    g_simple_async_result_set_check_cancellable (simple, cancellable);
+
+    g_simple_async_result_set_op_res_gboolean(simple, TRUE);
+    g_simple_async_result_complete_in_idle(simple);
+}
+
+static gboolean spice_gstaudio_get_record_volume_info_finish(SpiceAudio *audio,
+                                                             GAsyncResult *res,
+                                                             gboolean *mute,
+                                                             guint8 *nchannels,
+                                                             guint16 **volume,
+                                                             GError **error)
+{
+    SpiceGstaudioPrivate *p = SPICE_GSTAUDIO(audio)->priv;
+    GstElement *e;
+    gboolean lmute;
+    gdouble vol;
+    gboolean fake_channel = FALSE;
+    GSimpleAsyncResult *simple = (GSimpleAsyncResult *) res;
+
+    g_return_val_if_fail(g_simple_async_result_is_valid(res,
+        G_OBJECT(audio), spice_gstaudio_get_record_volume_info_async), FALSE);
+
+    if (g_simple_async_result_propagate_error(simple, error)) {
+        /* set out args that should have new alloc'ed memory to NULL */
+        if (volume != NULL) {
+            *volume = NULL;
+        }
+        return FALSE;
+    }
+
+    if (p->record.src == NULL || p->record.channels == 0) {
+        SPICE_DEBUG("RecordChannel not created yet, force start");
+        /* In order to get system volume, we start the pipeline */
+        record_start(NULL, SPICE_AUDIO_FMT_S16, 2, 48000, audio);
+        fake_channel = TRUE;
+    }
+
+    if (GST_IS_BIN(p->record.src))
+        e = gst_bin_get_by_interface(GST_BIN(p->record.src), GST_TYPE_STREAM_VOLUME);
+    else
+        e = g_object_ref(p->record.src);
+
+    if (GST_IS_STREAM_VOLUME(e)) {
+        vol = gst_stream_volume_get_volume(GST_STREAM_VOLUME(e), GST_STREAM_VOLUME_FORMAT_CUBIC);
+        lmute = gst_stream_volume_get_mute(GST_STREAM_VOLUME(e));
+    } else {
+        g_object_get(e,
+                     "volume", &vol,
+                     "mute", &lmute, NULL);
+    }
+    g_object_unref(e);
+
+    if (fake_channel) {
+        SPICE_DEBUG("Stop faked RecordChannel");
+        record_stop(SPICE_GSTAUDIO(audio));
+    }
+
+    if (mute != NULL) {
+        *mute = lmute;
+    }
+
+    if (nchannels != NULL) {
+        *nchannels = p->record.channels;
+    }
+
+    if (volume != NULL) {
+        gint i;
+        *volume = g_new(guint16, p->record.channels);
+        for (i = 0; i < p->record.channels; i++) {
+            (*volume)[i] = (guint16) (vol * VOLUME_NORMAL);
+            SPICE_DEBUG("(record) volume at %d is %u (%0.2f%%)", i, (*volume)[i], 100*vol);
+        }
+    }
+
+    return g_simple_async_result_get_op_res_gboolean(simple);
+}
commit 37ba949716ebf4411103308f4dbde75e81c7a9b3
Author: Victor Toso <victortoso at redhat.com>
Date:   Fri Apr 3 12:40:06 2015 +0200

    audio: spice-pulse implement async volume-info
    
    In case of volume-sync between client and guest, we request volume-info
    from the availables streams and if the stream is not available we rely
    on ext-stream-restore.
    
    By using ext-stream-restore we can get the last stream data of the
    application that is stored by PulseAudio.
    
    Related: https://bugzilla.redhat.com/show_bug.cgi?id=1012868

diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
index c583032..f101b0c 100644
--- a/gtk/spice-pulse.c
+++ b/gtk/spice-pulse.c
@@ -25,18 +25,34 @@
 
 #include <pulse/glib-mainloop.h>
 #include <pulse/pulseaudio.h>
+#include <pulse/ext-stream-restore.h>
 
 #define SPICE_PULSE_GET_PRIVATE(obj)                                  \
     (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_PULSE, SpicePulsePrivate))
 
+struct async_task {
+    SpicePulse                 *pulse;
+    SpiceMainChannel           *main_channel;
+    GSimpleAsyncResult         *res;
+    GAsyncReadyCallback        callback;
+    gpointer                   user_data;
+    gboolean                   is_playback;
+    pa_operation               *pa_op;
+    gulong                     cancel_id;
+    GCancellable               *cancellable;
+};
+
 struct stream {
-    pa_sample_spec          spec;
-    pa_stream               *stream;
-    int                     state;
-    pa_operation            *uncork_op;
-    pa_operation            *cork_op;
-    gboolean                started;
-    guint                   num_underflow;
+    pa_sample_spec             spec;
+    pa_stream                  *stream;
+    int                        state;
+    pa_operation               *uncork_op;
+    pa_operation               *cork_op;
+    gboolean                   started;
+    guint                      num_underflow;
+    gboolean                   info_updated;
+    gchar                      *name;
+    pa_ext_stream_restore_info info;
 };
 
 struct _SpicePulsePrivate {
@@ -50,6 +66,8 @@ struct _SpicePulsePrivate {
     struct stream           record;
     guint                   last_delay;
     guint                   target_delay;
+    struct async_task       *pending_restore_task;
+    GList                   *results;
 };
 
 G_DEFINE_TYPE(SpicePulse, spice_pulse, SPICE_TYPE_AUDIO)
@@ -77,6 +95,18 @@ static const char *context_state_names[] = {
 static void stream_stop(SpicePulse *pulse, struct stream *s);
 static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel);
 static void channel_weak_notified(gpointer data, GObject *where_the_object_was);
+static void spice_pulse_get_playback_volume_info_async(SpiceAudio *audio, GCancellable *cancellable,
+        SpiceMainChannel *main_channel, GAsyncReadyCallback callback, gpointer user_data);
+static gboolean spice_pulse_get_playback_volume_info_finish(SpiceAudio *audio, GAsyncResult *res,
+        gboolean *mute, guint8 *nchannels, guint16 **volume, GError **error);
+static void spice_pulse_get_record_volume_info_async(SpiceAudio *audio, GCancellable *cancellable,
+        SpiceMainChannel *main_channel, GAsyncReadyCallback callback, gpointer user_data);
+static gboolean spice_pulse_get_record_volume_info_finish(SpiceAudio *audio,GAsyncResult *res,
+        gboolean *mute, guint8 *nchannels, guint16 **volume, GError **error);
+static void stream_restore_read_cb(pa_context *context,
+        const pa_ext_stream_restore_info *info, int eol, void *userdata);
+static void spice_pulse_complete_async_task(struct async_task *task, const gchar *err_msg);
+static void spice_pulse_complete_all_async_tasks(SpicePulse *pulse, const gchar *err_msg);
 
 static void spice_pulse_finalize(GObject *obj)
 {
@@ -118,6 +148,12 @@ static void spice_pulse_dispose(GObject *obj)
         pa_operation_unref(p->record.cork_op);
     p->record.cork_op = NULL;
 
+    if (p->results != NULL)
+        spice_pulse_complete_all_async_tasks(pulse, "PulseAudio is being dispose");
+
+    g_clear_pointer(&p->playback.name, g_free);
+    g_clear_pointer(&p->record.name, g_free);
+
     if (p->pchannel)
         g_object_weak_unref(G_OBJECT(p->pchannel), channel_weak_notified, pulse);
     p->pchannel = NULL;
@@ -140,6 +176,10 @@ static void spice_pulse_class_init(SpicePulseClass *klass)
     SpiceAudioClass *audio_class = SPICE_AUDIO_CLASS(klass);
 
     audio_class->connect_channel = connect_channel;
+    audio_class->get_playback_volume_info_async = spice_pulse_get_playback_volume_info_async;
+    audio_class->get_playback_volume_info_finish = spice_pulse_get_playback_volume_info_finish;
+    audio_class->get_record_volume_info_async = spice_pulse_get_record_volume_info_async;
+    audio_class->get_record_volume_info_finish = spice_pulse_get_record_volume_info_finish;
 
     gobject_class->finalize = spice_pulse_finalize;
     gobject_class->dispose = spice_pulse_dispose;
@@ -812,18 +852,37 @@ static void context_state_callback(pa_context *c, void *userdata)
 
         if (!p->playback.stream && p->playback.started)
             create_playback(SPICE_PULSE(userdata));
+
+        if (p->pending_restore_task != NULL &&
+                p->pending_restore_task->pa_op == NULL) {
+            pa_operation *op = pa_ext_stream_restore_read(p->context,
+                                                          stream_restore_read_cb,
+                                                          pulse);
+            if (!op)
+                goto context_fail;
+            p->pending_restore_task->pa_op = op;
+        }
         break;
     }
 
     case PA_CONTEXT_FAILED:
         g_warning("PulseAudio context failed %s",
                   pa_strerror(pa_context_errno(p->context)));
-        break;
+        goto context_fail;
 
     case PA_CONTEXT_TERMINATED:
     default:
         SPICE_DEBUG("PulseAudio context terminated");
-        break;
+        goto context_fail;
+    }
+
+    return;
+
+context_fail:
+    if (p->pending_restore_task != NULL) {
+        const gchar *errmsg = pa_strerror(pa_context_errno(p->context));
+        errmsg = (errmsg != NULL) ? errmsg : "PulseAudio context terminated";
+        spice_pulse_complete_all_async_tasks(pulse, errmsg);
     }
 }
 
@@ -849,9 +908,421 @@ SpicePulse *spice_pulse_new(SpiceSession *session, GMainContext *context,
         goto error;
     }
 
+    p->playback.name = g_strconcat("sink-input-by-application-name:",
+                                   g_get_application_name(), NULL);
+    p->record.name = g_strconcat("source-output-by-application-name:",
+                                 g_get_application_name(), NULL);
     return pulse;
 
 error:
     g_object_unref(pulse);
     return  NULL;
 }
+
+static gboolean free_async_task(gpointer user_data)
+{
+    struct async_task *task = user_data;
+
+    if (task == NULL)
+        return G_SOURCE_REMOVE;
+
+    if (task->pa_op != NULL) {
+        pa_operation_cancel(task->pa_op);
+        pa_operation_unref(task->pa_op);
+        task->pa_op = NULL;
+    }
+
+    if (task->pulse) {
+        if (task->pulse->priv->pending_restore_task == task) {
+            task->pulse->priv->pending_restore_task = NULL;
+        }
+        g_object_unref(task->pulse);
+    }
+
+    if (task->res)
+        g_object_unref(task->res);
+
+    if (task->main_channel)
+        g_object_unref(task->main_channel);
+
+    if (task->pa_op != NULL)
+        pa_operation_unref(task->pa_op);
+
+    if (task->cancel_id != 0) {
+        g_cancellable_disconnect(task->cancellable, task->cancel_id);
+        g_clear_object(&task->cancellable);
+    }
+
+    g_free(task);
+    return G_SOURCE_REMOVE;
+}
+
+static void cancel_task(GCancellable *cancellable, gpointer user_data)
+{
+    struct async_task *task = user_data;
+    g_return_if_fail(task != NULL);
+
+#if GLIB_CHECK_VERSION(2,40,0)
+    free_async_task(task);
+#else
+    /* This must be done now otherwise pulseaudio may return to a
+     * cancelled task operation before free_async_task is called */
+    if (task->pa_op != NULL) {
+        pa_operation_cancel(task->pa_op);
+        pa_operation_unref(task->pa_op);
+        task->pa_op = NULL;
+    }
+
+    /* Clear the pending_restore_task reference to avoid triggering a
+     * pa_operation when context state is in READY state */
+    if (task->pulse->priv->pending_restore_task == task) {
+        task->pulse->priv->pending_restore_task = NULL;
+    }
+
+    /* FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=705395
+     * Free the memory in idle */
+    g_idle_add(free_async_task, task);
+#endif
+}
+
+static void complete_task(SpicePulse *pulse, struct async_task *task, const gchar *err_msg)
+{
+    SpicePulsePrivate *p = pulse->priv;
+
+    /* If we do have any err_msg, we failed */
+    if (err_msg != NULL) {
+        g_simple_async_result_set_op_res_gboolean(task->res, FALSE);
+        g_simple_async_result_set_error(task->res,
+                                        SPICE_CLIENT_ERROR,
+                                        SPICE_CLIENT_ERROR_FAILED,
+                                        "restore-info failed due %s",
+                                        err_msg);
+    /* Volume-info does not change if stream is not found */
+    } else if ((task->is_playback == TRUE && p->playback.info_updated == FALSE) ||
+               (task->is_playback == FALSE && p->record.info_updated == FALSE)) {
+        g_simple_async_result_set_op_res_gboolean(task->res, FALSE);
+        g_simple_async_result_set_error(task->res,
+                                        SPICE_CLIENT_ERROR,
+                                        SPICE_CLIENT_ERROR_FAILED,
+                                        "Stream not found by pulse");
+    } else {
+        g_simple_async_result_set_op_res_gboolean(task->res, TRUE);
+    }
+
+    /* As all async calls to PulseAudio are done with glib mainloop, it is
+     * safe to complete the operation synchronously here. */
+    g_simple_async_result_complete(task->res);
+}
+
+static void spice_pulse_complete_async_task(struct async_task *task, const gchar *err_msg)
+{
+    SpicePulsePrivate *p;
+
+    g_return_if_fail(task != NULL);
+    p = task->pulse->priv;
+
+    complete_task(task->pulse, task, err_msg);
+    if (p->results != NULL) {
+        p->results = g_list_remove(p->results, task);
+        SPICE_DEBUG("Number of async task is %d", g_list_length(p->results));
+    }
+    free_async_task(task);
+}
+
+static void spice_pulse_complete_all_async_tasks(SpicePulse *pulse, const gchar *err_msg)
+{
+    SpicePulsePrivate *p;
+    GList *it;
+
+    g_return_if_fail(pulse != NULL);
+    p = pulse->priv;
+
+    /* Complete all tasks in list */
+    for(it = p->results; it != NULL; it = it->next) {
+        struct async_task *task = it->data;
+        complete_task(pulse, task, err_msg);
+        free_async_task(task);
+    }
+    g_list_free(p->results);
+    p->results = NULL;
+    SPICE_DEBUG("All async tasks completed");
+}
+
+static void stream_restore_read_cb(pa_context *context,
+                                   const pa_ext_stream_restore_info *info,
+                                   int eol,
+                                   void *userdata)
+{
+    SpicePulsePrivate *p = SPICE_PULSE(userdata)->priv;
+    struct stream *pstream = NULL;
+
+    if (eol ||
+            (p->playback.info_updated == TRUE &&
+             p->record.info_updated == TRUE)) {
+        /* We only have one pa_operation running the stream-restore-info
+         * which retrieves volume-info from both Playback and Record channels;
+         * We can complete all async tasks now that this operation ended.
+         * (or we already have the volume-info we want)
+         * Note: the following function cancel the current pa_operation */
+        spice_pulse_complete_all_async_tasks(SPICE_PULSE(userdata), NULL);
+        return;
+    }
+
+    if (g_strcmp0(info->name, p->playback.name) == 0) {
+        pstream = &p->playback;
+    } else if (g_strcmp0(info->name, p->record.name) == 0) {
+        pstream = &p->record;
+    } else {
+        /* This is not the stream you are looking for. */
+        return;
+    }
+
+    if (info->channel_map.channels == 0) {
+        SPICE_DEBUG("Number of channels stored is zero. Ignore. (%s)", info->name);
+        return;
+    }
+
+    pstream->info_updated = TRUE;
+    pstream->info.name = pstream->name;
+    pstream->info.mute = info->mute;
+    pstream->info.channel_map = info->channel_map;
+    pstream->info.volume = info->volume;
+}
+
+static void source_output_info_cb(pa_context *context,
+                                  const pa_source_output_info *info,
+                                  int eol,
+                                  void *userdata)
+{
+    struct async_task *task = userdata;
+    SpicePulsePrivate *p = task->pulse->priv;
+    struct stream *pstream = &p->record;
+
+    if (eol) {
+        spice_pulse_complete_async_task(task, NULL);
+        return;
+    }
+
+    pstream->info_updated = TRUE;
+    pstream->info.name = pstream->name;
+    pstream->info.mute = info->mute;
+    pstream->info.channel_map = info->channel_map;
+    pstream->info.volume = info->volume;
+}
+
+static void sink_input_info_cb(pa_context *context,
+                               const pa_sink_input_info *info,
+                               int eol,
+                               void *userdata)
+{
+    struct async_task *task = userdata;
+    SpicePulsePrivate *p = task->pulse->priv;
+    struct stream *pstream = &p->playback;
+
+    if (eol) {
+        spice_pulse_complete_async_task(task, NULL);
+        return;
+    }
+
+    pstream->info_updated = TRUE;
+    pstream->info.name = pstream->name;
+    pstream->info.mute = info->mute;
+    pstream->info.channel_map = info->channel_map;
+    pstream->info.volume = info->volume;
+}
+
+/* to avoid code duplication */
+static void pulse_stream_restore_info_async(gboolean is_playback,
+                                            SpiceAudio *audio,
+                                            GCancellable *cancellable,
+                                            SpiceMainChannel *main_channel,
+                                            GAsyncReadyCallback callback,
+                                            gpointer user_data)
+{
+    SpicePulsePrivate *p = SPICE_PULSE(audio)->priv;
+    GSimpleAsyncResult *simple;
+    struct async_task *task = g_malloc0(sizeof(struct async_task));
+    pa_operation *op = NULL;
+
+    simple = g_simple_async_result_new(G_OBJECT(audio),
+                                       callback,
+                                       user_data,
+                                       pulse_stream_restore_info_async);
+    g_simple_async_result_set_check_cancellable (simple, cancellable);
+
+    task->res = simple;
+    task->pulse = g_object_ref(audio);
+    task->callback = callback;
+    task->user_data = user_data;
+    task->is_playback = is_playback;
+    task->main_channel = g_object_ref(main_channel);
+    task->pa_op = NULL;
+
+    if (cancellable) {
+        task->cancellable = g_object_ref(cancellable);
+        task->cancel_id = g_cancellable_connect(cancellable, G_CALLBACK(cancel_task), task, NULL);
+    }
+
+    /* If Playback/Record stream is created we use pulse API to get volume-info
+     * from those streams directly. If the stream is not created, retrieve last
+     * volume/mute values from Pulse database using the application name;
+     * If we already have retrieved volume-info from Pulse database then it is
+     * safe to return the volume-info we already have in <stream>info */
+
+    if (is_playback == TRUE &&
+            p->playback.stream != NULL &&
+            pa_stream_get_index(p->playback.stream) != PA_INVALID_INDEX) {
+        SPICE_DEBUG("Playback stream is created - get-sink-input-info");
+        p->playback.info_updated = FALSE;
+        op = pa_context_get_sink_input_info(p->context,
+                                            pa_stream_get_index(p->playback.stream),
+                                            sink_input_info_cb,
+                                            task);
+        if (!op)
+            goto fail;
+        task->pa_op = op;
+
+    } else if (is_playback == FALSE &&
+            p->record.stream != NULL &&
+            pa_stream_get_index(p->record.stream) != PA_INVALID_INDEX) {
+        SPICE_DEBUG("Record stream is created - get-source-output-info");
+        p->record.info_updated = FALSE;
+        op = pa_context_get_source_output_info(p->context,
+                                               pa_stream_get_index(p->record.stream),
+                                               source_output_info_cb,
+                                               task);
+        if (!op)
+            goto fail;
+        task->pa_op = op;
+
+    } else {
+        if (p->playback.info.name != NULL ||
+                p->record.info.name != NULL) {
+            /* If the pstream->info.name is set then we already have updated
+             * volume information. We can complete the request now */
+            SPICE_DEBUG("Return the volume-information we already have");
+            spice_pulse_complete_async_task(task, NULL);
+            return;
+        }
+
+        if (p->results == NULL) {
+            SPICE_DEBUG("Streams are not created - ext-stream-restore");
+            p->playback.info_updated = FALSE;
+            p->record.info_updated = FALSE;
+
+            if (pa_context_get_state(p->context) == PA_CONTEXT_READY) {
+                /* Restore value from pulse db */
+                op = pa_ext_stream_restore_read(p->context, stream_restore_read_cb, audio);
+                if (!op)
+                    goto fail;
+                task->pa_op = op;
+            } else {
+                /* It is possible that we want to get volume-info before the
+                 * context is in READY state. In this case, we wait for the
+                 * context state change to READY. */
+                p->pending_restore_task = task;
+            }
+        }
+    }
+
+    p->results = g_list_append(p->results, task);
+    SPICE_DEBUG ("Number of async task is %d", g_list_length(p->results));
+    return;
+
+fail:
+    if (!op) {
+        g_simple_async_report_error_in_idle(G_OBJECT(audio),
+                                            callback,
+                                            user_data,
+                                            SPICE_CLIENT_ERROR,
+                                            SPICE_CLIENT_ERROR_FAILED,
+                                            "Volume-Info failed: %s",
+                                            pa_strerror(pa_context_errno(p->context)));
+        free_async_task(task);
+    }
+}
+
+/* to avoid code duplication */
+static gboolean pulse_stream_restore_info_finish(gboolean is_playback,
+                                                 SpiceAudio *audio,
+                                                 GAsyncResult *res,
+                                                 gboolean *mute,
+                                                 guint8 *nchannels,
+                                                 guint16 **volume,
+                                                 GError **error)
+{
+    SpicePulsePrivate *p = SPICE_PULSE(audio)->priv;
+    struct stream *pstream = (is_playback) ? &p->playback : &p->record;
+    GSimpleAsyncResult *simple = (GSimpleAsyncResult *) res;
+
+    g_return_val_if_fail(g_simple_async_result_is_valid(res,
+        G_OBJECT(audio), pulse_stream_restore_info_async), FALSE);
+
+    if (g_simple_async_result_propagate_error(simple, error)) {
+        /* set out args that should have new alloc'ed memory to NULL */
+        if (volume != NULL) {
+            *volume = NULL;
+        }
+        return FALSE;
+    }
+
+    if (mute != NULL) {
+        *mute = (pstream->info.mute) ? TRUE : FALSE;
+    }
+
+    if (nchannels != NULL) {
+        *nchannels = pstream->info.channel_map.channels;
+    }
+
+    if (volume != NULL) {
+        gint i;
+        *volume = g_new(guint16, pstream->info.channel_map.channels);
+        for (i = 0; i < pstream->info.channel_map.channels; i++) {
+            (*volume)[i] = MIN(pstream->info.volume.values[i], G_MAXUINT16);
+            SPICE_DEBUG("(%s) volume at channel %d is %u",
+                        (is_playback) ? "playback" : "record", i, (*volume)[i]);
+        }
+    }
+
+    return g_simple_async_result_get_op_res_gboolean(simple);
+}
+
+static void spice_pulse_get_playback_volume_info_async(SpiceAudio *audio,
+                                                       GCancellable *cancellable,
+                                                       SpiceMainChannel *main_channel,
+                                                       GAsyncReadyCallback callback,
+                                                       gpointer user_data)
+{
+    pulse_stream_restore_info_async(TRUE, audio, cancellable, main_channel, callback, user_data);
+}
+
+static gboolean spice_pulse_get_playback_volume_info_finish(SpiceAudio *audio,
+                                                            GAsyncResult *res,
+                                                            gboolean *mute,
+                                                            guint8 *nchannels,
+                                                            guint16 **volume,
+                                                            GError **error)
+{
+    return pulse_stream_restore_info_finish(TRUE, audio, res, mute,
+                                            nchannels, volume, error);
+}
+
+static void spice_pulse_get_record_volume_info_async(SpiceAudio *audio,
+                                                     GCancellable *cancellable,
+                                                     SpiceMainChannel *main_channel,
+                                                     GAsyncReadyCallback callback,
+                                                     gpointer user_data)
+{
+    pulse_stream_restore_info_async(FALSE, audio, cancellable, main_channel, callback, user_data);
+}
+
+static gboolean spice_pulse_get_record_volume_info_finish(SpiceAudio *audio,
+                                                          GAsyncResult *res,
+                                                          gboolean *mute,
+                                                          guint8 *nchannels,
+                                                          guint16 **volume,
+                                                          GError **error)
+{
+    return pulse_stream_restore_info_finish(FALSE, audio, res, mute,
+                                            nchannels, volume, error);
+}
commit 29a6a342da427005c1f84c705a9435535c26d5e9
Author: Victor Toso <victortoso at redhat.com>
Date:   Fri Mar 6 19:01:57 2015 +0100

    audio: spice-audio with get mute and volume
    
    Async functions to be implemented by spice-gstaudio and spice-pulse to
    get the updated volume and mute values for playback and record stream.
    
    Related: https://bugzilla.redhat.com/show_bug.cgi?id=1012868

diff --git a/gtk/spice-audio-priv.h b/gtk/spice-audio-priv.h
index 898c5a7..f108059 100644
--- a/gtk/spice-audio-priv.h
+++ b/gtk/spice-audio-priv.h
@@ -29,6 +29,14 @@ struct _SpiceAudioPrivate {
     GMainContext            *main_context;
 };
 
+void spice_audio_get_playback_volume_info_async(SpiceAudio *audio, GCancellable *cancellable,
+        SpiceMainChannel *main_channel, GAsyncReadyCallback callback, gpointer user_data);
+gboolean spice_audio_get_playback_volume_info_finish(SpiceAudio *audio, GAsyncResult *res,
+        gboolean *mute, guint8 *nchannels, guint16 **volume, GError **error);
+void spice_audio_get_record_volume_info_async(SpiceAudio *audio, GCancellable *cancellable,
+        SpiceMainChannel *main_channel, GAsyncReadyCallback callback, gpointer user_data);
+gboolean spice_audio_get_record_volume_info_finish(SpiceAudio *audio, GAsyncResult *res,
+        gboolean *mute, guint8 *nchannels, guint16 **volume, GError **error);
 G_END_DECLS
 
 #endif /* __SPICE_AUDIO_PRIVATE_H__ */
diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index 329ab6a..7784c8b 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -191,6 +191,48 @@ static void session_enable_audio(GObject *gobject, GParamSpec *pspec,
     update_audio_channels(SPICE_AUDIO(user_data), SPICE_SESSION(gobject));
 }
 
+void spice_audio_get_playback_volume_info_async(SpiceAudio *audio,
+                                                GCancellable *cancellable,
+                                                SpiceMainChannel *main_channel,
+                                                GAsyncReadyCallback callback,
+                                                gpointer user_data)
+{
+    SPICE_AUDIO_GET_CLASS(audio)->get_playback_volume_info_async(audio,
+            cancellable, main_channel, callback, user_data);
+}
+
+gboolean spice_audio_get_playback_volume_info_finish(SpiceAudio *audio,
+                                                     GAsyncResult *res,
+                                                     gboolean *mute,
+                                                     guint8 *nchannels,
+                                                     guint16 **volume,
+                                                     GError **error)
+{
+    return SPICE_AUDIO_GET_CLASS(audio)->get_playback_volume_info_finish(audio,
+            res, mute, nchannels, volume, error);
+}
+
+void spice_audio_get_record_volume_info_async(SpiceAudio *audio,
+                                              GCancellable *cancellable,
+                                              SpiceMainChannel *main_channel,
+                                              GAsyncReadyCallback callback,
+                                              gpointer user_data)
+{
+    SPICE_AUDIO_GET_CLASS(audio)->get_record_volume_info_async(audio,
+            cancellable, main_channel, callback, user_data);
+}
+
+gboolean spice_audio_get_record_volume_info_finish(SpiceAudio *audio,
+                                                   GAsyncResult *res,
+                                                   gboolean *mute,
+                                                   guint8 *nchannels,
+                                                   guint16 **volume,
+                                                   GError **error)
+{
+    return SPICE_AUDIO_GET_CLASS(audio)->get_record_volume_info_finish(audio,
+            res, mute, nchannels, volume, error);
+}
+
 /**
  * spice_audio_new:
  * @session: the #SpiceSession to connect to
diff --git a/gtk/spice-audio.h b/gtk/spice-audio.h
index ebc4946..0bf625b 100644
--- a/gtk/spice-audio.h
+++ b/gtk/spice-audio.h
@@ -19,8 +19,10 @@
 #define __SPICE_CLIENT_AUDIO_H__
 
 #include <glib-object.h>
+#include <gio/gio.h>
 #include "spice-util.h"
 #include "spice-session.h"
+#include "channel-main.h"
 
 G_BEGIN_DECLS
 
@@ -67,8 +69,30 @@ struct _SpiceAudioClass {
 
     /*< private >*/
     gboolean (*connect_channel)(SpiceAudio *audio, SpiceChannel *channel);
-
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
+    void (*get_playback_volume_info_async)(SpiceAudio *audio,
+                                           GCancellable *cancellable,
+                                           SpiceMainChannel *main_channel,
+                                           GAsyncReadyCallback callback,
+                                           gpointer user_data);
+    gboolean (*get_playback_volume_info_finish)(SpiceAudio *audio,
+                                                GAsyncResult *res,
+                                                gboolean *mute,
+                                                guint8 *nchannels,
+                                                guint16 **volume,
+                                                GError **error);
+    void (*get_record_volume_info_async)(SpiceAudio *audio,
+                                         GCancellable *cancellable,
+                                         SpiceMainChannel *main_channel,
+                                         GAsyncReadyCallback callback,
+                                         gpointer user_data);
+    gboolean (*get_record_volume_info_finish)(SpiceAudio *audio,
+                                              GAsyncResult *res,
+                                              gboolean *mute,
+                                              guint8 *nchannels,
+                                              guint16 **volume,
+                                              GError **error);
+
+    gchar _spice_reserved[SPICE_RESERVED_PADDING - 4 * sizeof(void *)];
 };
 
 GType spice_audio_get_type(void);
commit 7e0313d46d61f3cdb23fb180695a22f6a762d50f
Author: Victor Toso <victortoso at redhat.com>
Date:   Fri Apr 24 17:23:07 2015 +0200

    Update spice-common submodule
    
    This includes volume synchronization protocol;

diff --git a/spice-common b/spice-common
index 3aad79d..fec8031 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 3aad79d9c64e85bc2b474df427ccbedbf6840591
+Subproject commit fec803156b1844a2deb705cf55933294ca60a5ea


More information about the Spice-commits mailing list