[Telepathy-commits] [telepathy-glib/master] ExampleCallableMediaStream: make the remote contact agree to send media
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Mar 16 07:52:31 PDT 2009
---
examples/cm/callable/media-stream.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/examples/cm/callable/media-stream.c b/examples/cm/callable/media-stream.c
index 643fa23..0c207cc 100644
--- a/examples/cm/callable/media-stream.c
+++ b/examples/cm/callable/media-stream.c
@@ -346,6 +346,24 @@ example_callable_media_stream_close (ExampleCallableMediaStream *self)
}
}
+static gboolean
+simulate_contact_agreed_to_send_cb (gpointer p)
+{
+ ExampleCallableMediaStream *self = p;
+
+ if (self->priv->removed ||
+ !(self->priv->pending_send & TP_MEDIA_STREAM_PENDING_REMOTE_SEND))
+ return;
+
+ g_message ("SIGNALLING: receive: OK, I'll send you media on stream %u",
+ self->priv->id);
+
+ self->priv->direction |= TP_MEDIA_STREAM_DIRECTION_RECEIVE;
+ self->priv->pending_send &= ~TP_MEDIA_STREAM_PENDING_REMOTE_SEND;
+
+ g_signal_emit (self, signals[SIGNAL_DIRECTION_CHANGED], 0);
+}
+
gboolean
example_callable_media_stream_change_direction (
ExampleCallableMediaStream *self,
@@ -410,8 +428,9 @@ example_callable_media_stream_change_direction (
self->priv->id);
changed = TRUE;
self->priv->pending_send |= TP_MEDIA_STREAM_PENDING_REMOTE_SEND;
- /* FIXME: schedule a timeout, after which the sender will accept
- * our request */
+ g_timeout_add_full (G_PRIORITY_DEFAULT, 1000,
+ simulate_contact_agreed_to_send_cb, g_object_ref (self),
+ g_object_unref);
}
}
else
--
1.5.6.5
More information about the telepathy-commits
mailing list