[Spice-devel] [PATCH spice-gtk 2/5] playback: do not set mm time when session-less
Marc-André Lureau
marcandre.lureau at redhat.com
Wed Apr 29 08:06:45 PDT 2015
Channels do not hold a strong reference on the session (because session
can be recycled after disconnect), do not print a warning if the channel
is session-less when updating the delay.
---
gtk/channel-playback.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index 9d45e1f..d8a181e 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -452,6 +452,7 @@ static void channel_set_handlers(SpiceChannelClass *klass)
void spice_playback_channel_set_delay(SpicePlaybackChannel *channel, guint32 delay_ms)
{
SpicePlaybackChannelPrivate *c;
+ SpiceSession *session;
g_return_if_fail(SPICE_IS_PLAYBACK_CHANNEL(channel));
@@ -459,8 +460,13 @@ void spice_playback_channel_set_delay(SpicePlaybackChannel *channel, guint32 del
c = channel->priv;
c->latency = delay_ms;
- spice_session_set_mm_time(spice_channel_get_session(SPICE_CHANNEL(channel)),
- c->last_time - delay_ms);
+
+ session = spice_channel_get_session(SPICE_CHANNEL(channel));
+ if (session) {
+ spice_session_set_mm_time(session, c->last_time - delay_ms);
+ } else {
+ CHANNEL_DEBUG(channel, "channel detached from session, mm time skipped");
+ }
}
G_GNUC_INTERNAL
--
2.1.0
More information about the Spice-devel
mailing list