[Telepathy-commits] [mingle/master] Start farsight streams in the receiving only direction and change to the final direction once the call is accepted

Sjoerd Simons sjoerd at luon.net
Tue Nov 4 10:17:06 PST 2008


---
 jingle.py |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/jingle.py b/jingle.py
index bdfdb85..fa67c4b 100644
--- a/jingle.py
+++ b/jingle.py
@@ -73,13 +73,14 @@ class JingleBaseDescription:
     def got_initiate(self, fssession, fsstream, content):
         self.prepare(fssession)
         self.initiate(fsstream)
-        self.remote_codecs = self.content_to_codecs(content)
+        codecs = self.content_to_codecs(content)
+        fsstream.set_remote_codecs(codecs)
 
     def ready_for_accept(self):
         return self.fssession.get_codecs()
 
     def accepted(self):
-        self.fsstream.set_remote_codecs(self.remote_codecs)
+        pass
 
     def session_accept(self, content):
         codecs = self.content_to_codecs(content)
@@ -352,6 +353,8 @@ class JingleContent:
         self.description = None
         self.transport = None
         self.initiator = initiator
+        self.accepted = False
+        self.direction = farsight.DIRECTION_BOTH
 
     def transport_info(self, stanza):
       self.transport.transport_info(stanza)
@@ -369,11 +372,16 @@ class JingleContent:
                 direction = farsight.DIRECTION_BOTH
             else:
                 raise "Invalid content modify!!!"
-            self.description.change_direction(direction)
+            self.direction = direction
+
+            if self.accepted:
+                self.description.change_direction(direction)
 
     def session_accept(self, stanza):
+      self.accepted = True
       self.transport.session_accept(stanza)
       self.description.session_accept(stanza)
+      self.description.change_direction(self.direction)
 
     def add_content(self, parent):
         # Add the content
@@ -386,7 +394,9 @@ class JingleContent:
         self.transport.add_transport(content)
 
     def accepted(self):
+        self.accepted = True
         self.description.accepted()
+        self.description.change_direction(self.direction)
 
     def send_transport_info(self, transport):
        content = domish.Element((self.session.namespace, 'content'))
@@ -756,6 +766,7 @@ class JingleConference(fs2.Conference):
 
         fsstream = session.add_participant(participant, transmitter,
             transmitter_params)
+        fsstream.set_direction (farsight.DIRECTION_RECV)
 
         stream = JingleStream(fsstream, namespace)
         self.streams[session][participant] = stream
-- 
1.5.6.5




More information about the Telepathy-commits mailing list