[telepathy-gabble/telepathy-gabble-0.8] Recognize clients as media capable if they have any supported transport

Dafydd Harries dafydd.harries at collabora.co.uk
Mon Sep 28 15:43:29 PDT 2009


Before gabble would only regard a client as audio and/or video capable when it
support Google p2p as a transport. For jingle clients it's ofcouse entirely
valid to not support Google p2p.

Allow clients to be marked as media capable if they support any of our
supported protocol (they still need to also advertise jingle/gtalk capabilities
seperatly. This is correct as we support all our transports as part of a normal
jingle session and for the google protocol it's not necessary to advertise a
transport.

(This is a version of a16a31a backported to 0.8, which has pretty different
caps code.)
---
 src/media-channel.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index ecb60ff..b0d15b0 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2850,6 +2850,16 @@ TpChannelMediaCapabilities
 _gabble_media_channel_caps_to_typeflags (GabblePresenceCapabilities caps)
 {
   TpChannelMediaCapabilities typeflags = 0;
+  TpChannelMediaCapabilities any_transport =
+      PRESENCE_CAP_GOOGLE_TRANSPORT_P2P |
+      PRESENCE_CAP_JINGLE_TRANSPORT_RAWUDP |
+      PRESENCE_CAP_JINGLE_TRANSPORT_ICEUDP;
+  TpChannelMediaCapabilities jingle_audio =
+      PRESENCE_CAP_JINGLE_DESCRIPTION_AUDIO |
+      PRESENCE_CAP_JINGLE_RTP_AUDIO;
+  TpChannelMediaCapabilities jingle_video =
+      PRESENCE_CAP_JINGLE_DESCRIPTION_VIDEO |
+      PRESENCE_CAP_JINGLE_RTP_VIDEO;
 
   /* this is intentionally asymmetric to the previous function - we don't
    * require the other end to advertise the GTalk-P2P transport capability
@@ -2857,17 +2867,11 @@ _gabble_media_channel_caps_to_typeflags (GabblePresenceCapabilities caps)
    * implied Google session and GTalk-P2P */
 
   if ((caps & PRESENCE_CAP_GOOGLE_VOICE) ||
-      ((caps & ( PRESENCE_CAP_JINGLE_DESCRIPTION_AUDIO
-               | PRESENCE_CAP_JINGLE_RTP_AUDIO
-               )) &&
-       (caps & PRESENCE_CAP_GOOGLE_TRANSPORT_P2P)))
+      ((caps & any_transport) && (caps & jingle_audio)))
         typeflags |= TP_CHANNEL_MEDIA_CAPABILITY_AUDIO;
 
-  if ( (caps & PRESENCE_CAP_GOOGLE_VIDEO) ||
-      ((caps & ( PRESENCE_CAP_JINGLE_DESCRIPTION_VIDEO
-               | PRESENCE_CAP_JINGLE_RTP_VIDEO
-               )) &&
-       (caps & PRESENCE_CAP_GOOGLE_TRANSPORT_P2P)))
+  if ((caps & PRESENCE_CAP_GOOGLE_VIDEO) ||
+      ((caps & any_transport) && (caps & jingle_video)))
         typeflags |= TP_CHANNEL_MEDIA_CAPABILITY_VIDEO;
 
   return typeflags;
-- 
1.5.6.5




More information about the telepathy-commits mailing list