[telepathy-gabble/master] Ignore payload-types meant for different media

Sjoerd Simons sjoerd.simons at collabora.co.uk
Thu Jun 25 09:59:40 PDT 2009


In Gtalk3 the audio and video content description are mixed in the xml tree, so
let the content parser for audio ignore the payload-types meant for video and
vice versa.
---
 src/jingle-media-rtp.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/jingle-media-rtp.c b/src/jingle-media-rtp.c
index c3b7565..533351a 100644
--- a/src/jingle-media-rtp.c
+++ b/src/jingle-media-rtp.c
@@ -504,6 +504,8 @@ parse_description (GabbleJingleContent *content,
   GList *codecs = NULL;
   JingleCodec *p;
   LmMessageNode *node;
+  JingleDialect dialect;
+  gboolean video_session = FALSE;
 
   DEBUG ("node: %s", desc_node->name);
 
@@ -515,13 +517,41 @@ parse_description (GabbleJingleContent *content,
   if (mtype == JINGLE_MEDIA_TYPE_NONE)
     return;
 
+  g_object_get (content->session, "dialect", &dialect, NULL);
+
   DEBUG ("detected media type %u", mtype);
 
+  if (dialect == JINGLE_DIALECT_GTALK3)
+    {
+      const gchar *desc_ns =
+        lm_message_node_get_namespace (desc_node);
+      video_session = !tp_strdiff (desc_ns, NS_GOOGLE_SESSION_VIDEO);
+    }
+
   for (node = desc_node->children; node; node = node->next)
     {
       if (tp_strdiff (lm_message_node_get_name (node), "payload-type"))
         continue;
 
+      if (dialect == JINGLE_DIALECT_GTALK3)
+        {
+          const gchar *pt_ns =
+            lm_message_node_get_namespace (node);
+
+          if (priv->media_type == JINGLE_MEDIA_TYPE_AUDIO)
+            {
+              if (video_session &&
+                  tp_strdiff (pt_ns, NS_GOOGLE_SESSION_PHONE))
+                continue;
+            }
+          else if (priv->media_type == JINGLE_MEDIA_TYPE_VIDEO)
+            {
+              if (!(video_session && pt_ns == NULL)
+                    && tp_strdiff (pt_ns, NS_GOOGLE_SESSION_VIDEO))
+                continue;
+            }
+        }
+
       p = parse_payload_type (node);
 
       if (p == NULL)
-- 
1.5.6.5




More information about the telepathy-commits mailing list