[Telepathy-commits] [mingle/master] Correctly set the clockrate attribute

Sjoerd Simons sjoerd at luon.net
Tue Nov 11 11:27:32 PST 2008


Make the JingleBaseDescription set the clock rate in the "clockrate" attribute
instead of the "rate attribute".  While making the JingleGoogleDescription
override add_payloads to not set codec parameters and do set the clockrate as
the "rate" attribute.
---
 jingle.py |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/jingle.py b/jingle.py
index f818aaa..7e25807 100644
--- a/jingle.py
+++ b/jingle.py
@@ -48,7 +48,7 @@ class JingleBaseDescription:
             pt = parent.addElement('payload-type')
             pt['id'] = str(c.id)
             pt['name'] = c.encoding_name
-            pt['rate'] = str(c.clock_rate)
+            pt['clockrate'] = str(c.clock_rate)
             if c.channels > 0:
                 pt['channels'] = str(c.channels)
 
@@ -68,10 +68,14 @@ class JingleBaseDescription:
 
         codecs = []
         for p in payloads:
-            codec = farsight.Codec(int(p["id"]),
-                                    p["name"],
-                                    self.type,
-                                    int(p["rate"]))
+            if p.hasAttribute("rate"):
+                rate = int(p["rate"])
+            elif p.hasAttribute("clockrate"):
+                rate = int(p["clockrate"])
+            else:
+                rate =0
+
+            codec = farsight.Codec(int(p["id"]), p["name"], self.type, rate)
 
             params = xpath.queryForNodes("/payload-type/parameter", p)
             if params !=None:
@@ -290,6 +294,15 @@ class JingleGoogleTransport(JingleBaseTransport):
         self.transmitter_params['compatibility-mode'] = 1
         self.transmitter_params['debug'] = False
 
+    def add_payloads(self, parent):
+        for c in self.codecs:
+            pt = parent.addElement('payload-type')
+            pt['id'] = str(c.id)
+            pt['name'] = c.encoding_name
+            pt['rate'] = str(c.clock_rate)
+            if c.channels > 0:
+                pt['channels'] = str(c.channels)
+
     def new_local_candidate(self, fscandidate):
         if fscandidate.component_id == farsight.COMPONENT_RTP:
             JingleBaseTransport.new_local_candidate(self, fscandidate)
-- 
1.5.6.5




More information about the Telepathy-commits mailing list