[farsight2/master] Implement proper codec distribution in fs2-gui

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:24:10 PST 2008


---
 tests/gui/fs2-gui.py     |   27 +++++++++++++++++++++------
 tests/gui/fs2_gui_net.py |    2 +-
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/tests/gui/fs2-gui.py b/tests/gui/fs2-gui.py
index 0ea360f..0edd644 100644
--- a/tests/gui/fs2-gui.py
+++ b/tests/gui/fs2-gui.py
@@ -484,13 +484,13 @@ class FsUIStream:
         self.candidates = []
     def codecs(self, codecs):
         "Callback for the network object. Set the codecs"
-        self.codecs = codecs
 
         print "Remote codecs"
-        for c in self.codecs:
-            print "Got remote codec " + c.to_string()
+        for c in codecs:
+            print "Got remote codec from %s/%s %s" % \
+                  (self.participant.id, self.id, c.to_string())
         try:
-            self.fsstream.set_remote_codecs(self.codecs)
+            self.fsstream.set_remote_codecs(codecs)
         except AttributeError:
             print "Tried to set codecs with 0 codec"
         self.send_local_codecs()
@@ -502,7 +502,7 @@ class FsUIStream:
         self.check_send_local_codecs()
 
     def check_send_local_codecs(self):
-        "Internal function to send codecs when they're ready"
+        "Internal function to send our local codecs when they're ready"
         if not self.send_codecs:
             return
         if not self.session.fssession.get_property("codecs-ready"):
@@ -520,6 +520,18 @@ class FsUIStream:
         self.participant.recv_codecs_changed()
 
 
+    def __remove_from_send_codecs_to(self, participant):
+        self.send_codecs_to.remote(participant)
+
+    def send_codecs_to(self, participant):
+        codecs = self.fsstream.get_property("negotiated-codecs")
+        print "sending stream %s codecs from %s to %s" % \
+              (self.id, self.participant.id, participant.id)
+        if codecs:
+            participant.connect.send_codecs(participant.id, self.id, codecs,
+                                            self.participant.id)            
+
+
 class FsUIParticipant:
     "Wraps one FsParticipant, is one user remote contact"
     
@@ -675,7 +687,10 @@ class FsUIParticipant:
                                                  c.encoding_name,
                                                  c.clock_rate)
         self.label.set_markup(str)
-                
+
+    def send_codecs_to(self, participant):
+        for sid in self.streams:
+            self.streams[sid].send_codecs_to(participant)
     
 
 class FsMainUI:
diff --git a/tests/gui/fs2_gui_net.py b/tests/gui/fs2_gui_net.py
index a202017..839e0e5 100644
--- a/tests/gui/fs2_gui_net.py
+++ b/tests/gui/fs2_gui_net.py
@@ -428,7 +428,7 @@ if __name__ == "__main__":
                 self.streams[id].send_local_codecs()
         def destroy(self):
             pass
-        def send_codecs(self, participant):
+        def send_codecs_to(self, participant):
             for sid in self.streams:
                 print "to: %s from: %s" % (str(participant.id), (self.id))
                 participant.connect.send_codecs(participant.id,
-- 
1.5.6.5




More information about the farsight-commits mailing list