[Spice-devel] [PATCH spice-gtk 7/8] playback: support syncing the playback latency via session
Yonit Halperin
yhalperi at redhat.com
Tue Feb 26 10:04:57 PST 2013
---
gtk/channel-playback-priv.h | 1 +
gtk/channel-playback.c | 9 +++++++++
gtk/spice-session-priv.h | 1 +
gtk/spice-session.c | 15 +++++++++++++++
4 files changed, 26 insertions(+)
diff --git a/gtk/channel-playback-priv.h b/gtk/channel-playback-priv.h
index dc89e2d..aa33d2c 100644
--- a/gtk/channel-playback-priv.h
+++ b/gtk/channel-playback-priv.h
@@ -20,4 +20,5 @@
gboolean spice_playback_channel_is_active(SpicePlaybackChannel *channel);
guint32 spice_playback_channel_get_latency(SpicePlaybackChannel *channel);
+void spice_playback_channel_sync_latency(SpicePlaybackChannel *channel);
#endif
diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index 1c41940..14d70b5 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -570,3 +570,12 @@ guint32 spice_playback_channel_get_latency(SpicePlaybackChannel *channel)
}
return channel->priv->latency;
}
+
+G_GNUC_INTERNAL
+void spice_playback_channel_sync_latency(SpicePlaybackChannel *channel)
+{
+ g_return_if_fail(SPICE_IS_PLAYBACK_CHANNEL(channel));
+ g_return_if_fail(channel->priv->is_active);
+ SPICE_DEBUG("%s: notify latency update %u", __FUNCTION__, channel->priv->min_latency);
+ g_object_notify_main_context(G_OBJECT(SPICE_CHANNEL(channel)), "min-latency");
+}
diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h
index 4cf5fe9..e12ae2d 100644
--- a/gtk/spice-session-priv.h
+++ b/gtk/spice-session-priv.h
@@ -157,6 +157,7 @@ void spice_session_set_uuid(SpiceSession *session, guint8 uuid[16]);
void spice_session_set_name(SpiceSession *session, const gchar *name);
gboolean spice_session_is_playback_active(SpiceSession *session);
guint32 spice_session_get_playback_latency(SpiceSession *session);
+void spice_session_sync_playback_latency(SpiceSession *session);
G_END_DECLS
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 25cd6e4..0d46730 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -2067,6 +2067,21 @@ void spice_session_set_name(SpiceSession *session, const gchar *name)
}
G_GNUC_INTERNAL
+void spice_session_sync_playback_latency(SpiceSession *session)
+{
+ SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
+
+ g_return_if_fail(s != NULL);
+
+ if (s->playback_channel &&
+ spice_playback_channel_is_active(s->playback_channel)) {
+ spice_playback_channel_sync_latency(s->playback_channel);
+ } else {
+ SPICE_DEBUG("%s: not implemented when there isn't audio playback", __FUNCTION__);
+ }
+}
+
+G_GNUC_INTERNAL
gboolean spice_session_is_playback_active(SpiceSession *session)
{
SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
--
1.8.1
More information about the Spice-devel
mailing list