[Telepathy-commits] [telepathy-gabble/master] Media{Stream, Channel}: make stream directionality NONE initially so that the client has to request stream direction and approve local sending

Senko Rasic senko at tachyon.lan
Wed Feb 11 05:54:29 PST 2009


---
 src/media-channel.c                        |    4 ++++
 src/media-stream.c                         |    2 +-
 tests/twisted/jingle/test-incoming-call.py |   16 +++++++++++++---
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index 22b3583..176e6c4 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2375,6 +2375,10 @@ create_stream_from_content (GabbleMediaChannel *chan, GabbleJingleContent *c)
   /* A stream being added might cause the "total" hold state to change */
   stream_hold_state_changed (stream, NULL, chan);
 
+  /* Initial stream direction was changed before we had time to hook up
+   * signal handler, so we call the handler manually to pick it up. */
+  stream_direction_changed_cb (stream, NULL, chan);
+
   if (priv->ready)
     {
       /* all of the streams are bidirectional from farsight's point of view, it's
diff --git a/src/media-stream.c b/src/media-stream.c
index 841a887..2fe72e0 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -481,7 +481,7 @@ gabble_media_stream_class_init (GabbleMediaStreamClass *gabble_media_stream_clas
       MAKE_COMBINED_DIRECTION (TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL,
         TP_MEDIA_STREAM_PENDING_LOCAL_SEND |
         TP_MEDIA_STREAM_PENDING_REMOTE_SEND),
-      TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL,
+      TP_MEDIA_STREAM_DIRECTION_NONE,
       G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
       G_PARAM_STATIC_BLURB);
   g_object_class_install_property (object_class, PROP_COMBINED_DIRECTION,
diff --git a/tests/twisted/jingle/test-incoming-call.py b/tests/twisted/jingle/test-incoming-call.py
index 2d28904..aaffbb1 100644
--- a/tests/twisted/jingle/test-incoming-call.py
+++ b/tests/twisted/jingle/test-incoming-call.py
@@ -54,19 +54,29 @@ def test(q, bus, conn, stream):
              args=[u'', [], [], [1L], [], remote_handle, 0])
 
     media_chan = make_channel_proxy(conn, tp_path_prefix + e.path, 'Channel.Interface.Group')
+    media_iface = make_channel_proxy(conn, tp_path_prefix + e.path, 'Channel.Type.StreamedMedia')
 
     # S-E gets notified about new session handler, and calls Ready on it
     e = q.expect('dbus-signal', signal='NewSessionHandler')
     assert e.args[1] == 'rtp'
-
     session_handler = make_channel_proxy(conn, e.args[0], 'Media.SessionHandler')
     session_handler.Ready()
 
+    e2, e3 = q.expect_many(
+        EventPattern('dbus-signal', signal='NewStreamHandler'),
+        EventPattern('dbus-signal', signal='StreamDirectionChanged'))
 
     # S-E gets notified about a newly-created stream
-    e = q.expect('dbus-signal', signal='NewStreamHandler')
+    stream_handler = make_channel_proxy(conn, e2.args[0], 'Media.StreamHandler')
+
+    stream_id = e3.args[0]
+    assert e3.args[1] == 2 # active direction - receive
+    assert e3.args[2] == 1 # pending local send
+    media_iface.RequestStreamDirection(stream_id, 3) # allow local send
+
+    e = q.expect('dbus-signal', signal='StreamDirectionChanged',
+        args=[stream_id, 3, 0])
 
-    stream_handler = make_channel_proxy(conn, e.args[0], 'Media.StreamHandler')
 
     # Exercise channel properties
     channel_props = media_chan.GetAll(
-- 
1.5.6.5



More information about the telepathy-commits mailing list