[Telepathy-commits] [telepathy-glib/master] ExampleMediaChannel: Accept all proposed stream directions when we answer a call
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Mar 18 11:19:30 PDT 2009
This matches telepathy-gabble's behaviour.
---
examples/cm/callable/media-channel.c | 9 +++++++++
examples/cm/callable/media-stream.c | 17 +++++++++++++++++
examples/cm/callable/media-stream.h | 2 ++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/examples/cm/callable/media-channel.c b/examples/cm/callable/media-channel.c
index 2a7a5ed..b8a261a 100644
--- a/examples/cm/callable/media-channel.c
+++ b/examples/cm/callable/media-channel.c
@@ -500,6 +500,8 @@ add_member (GObject *object,
{
/* We're in local-pending, move to members to accept. */
TpIntSet *set = tp_intset_new_containing (member);
+ GHashTableIter iter;
+ gpointer v;
g_message ("SIGNALLING: send: Accepting incoming call from %s",
tp_handle_inspect (contact_repo, self->priv->handle));
@@ -511,6 +513,13 @@ add_member (GObject *object,
NULL /* nobody added to remote pending */,
member /* actor */, TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
+ g_hash_table_iter_init (&iter, self->priv->streams);
+
+ while (g_hash_table_iter_next (&iter, NULL, &v))
+ {
+ example_callable_media_stream_accept_proposed_direction (v);
+ }
+
return TRUE;
}
diff --git a/examples/cm/callable/media-stream.c b/examples/cm/callable/media-stream.c
index a9ada6a..2b59d4b 100644
--- a/examples/cm/callable/media-stream.c
+++ b/examples/cm/callable/media-stream.c
@@ -370,6 +370,23 @@ example_callable_media_stream_close (ExampleCallableMediaStream *self)
}
void
+example_callable_media_stream_accept_proposed_direction (
+ ExampleCallableMediaStream *self)
+{
+ if (self->priv->removed ||
+ !(self->priv->pending_send & TP_MEDIA_STREAM_PENDING_LOCAL_SEND))
+ return;
+
+ g_message ("SIGNALLING: send: OK, I'll send you media on stream %u",
+ self->priv->id);
+
+ self->priv->direction |= TP_MEDIA_STREAM_DIRECTION_SEND;
+ self->priv->pending_send &= ~TP_MEDIA_STREAM_PENDING_LOCAL_SEND;
+
+ g_signal_emit (self, signals[SIGNAL_DIRECTION_CHANGED], 0);
+}
+
+void
example_callable_media_stream_simulate_contact_agreed_to_send (
ExampleCallableMediaStream *self)
{
diff --git a/examples/cm/callable/media-stream.h b/examples/cm/callable/media-stream.h
index 4cff5b8..e7ec048 100644
--- a/examples/cm/callable/media-stream.h
+++ b/examples/cm/callable/media-stream.h
@@ -71,6 +71,8 @@ void example_callable_media_stream_close (ExampleCallableMediaStream *self);
gboolean example_callable_media_stream_change_direction (
ExampleCallableMediaStream *self, TpMediaStreamDirection direction,
GError **error);
+void example_callable_media_stream_accept_proposed_direction (
+ ExampleCallableMediaStream *self);
void example_callable_media_stream_connect (ExampleCallableMediaStream *self);
/* This controls receiving emulated network events, so it wouldn't exist in
--
1.5.6.5
More information about the telepathy-commits
mailing list