[Telepathy-commits] [telepathy-gabble/master] support component numbering in jingle transports (still ignore everything except rtp for now)
Senko Rasic
senko.rasic at collabora.co.uk
Tue Dec 2 04:34:11 PST 2008
---
src/jingle-content.h | 1 +
src/jingle-transport-google.c | 25 +++++++++++++++++--------
src/jingle-transport-iface.c | 3 ++-
src/jingle-transport-iface.h | 7 ++++---
src/media-stream.c | 13 +++++++++----
5 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/src/jingle-content.h b/src/jingle-content.h
index 6a1f92e..2753eab 100644
--- a/src/jingle-content.h
+++ b/src/jingle-content.h
@@ -44,6 +44,7 @@ typedef enum {
struct _JingleCandidate {
gchar *address;
+ int component;
int port;
int generation;
diff --git a/src/jingle-transport-google.c b/src/jingle-transport-google.c
index 7ca41d6..e1a64b0 100644
--- a/src/jingle-transport-google.c
+++ b/src/jingle-transport-google.c
@@ -241,12 +241,10 @@ parse_candidates (GabbleJingleTransportIface *obj,
GList *candidates = NULL;
LmMessageNode *node;
- DEBUG ("called");
-
for (node = transport_node->children; node; node = node->next)
{
const gchar *name, *address, *user, *pass, *str;
- guint port, net, gen;
+ guint port, net, gen, component = 1;
gdouble pref;
JingleTransportProtocol proto;
JingleCandidateType ctype;
@@ -345,11 +343,14 @@ parse_candidates (GabbleJingleTransportIface *obj,
str = lm_message_node_get_attribute (node, "generation");
if (str == NULL)
break;
-
gen = atoi (str);
- c = jingle_candidate_new (address, port, proto, pref,
- ctype, user, pass, net, gen);
+ str = lm_message_node_get_attribute (node, "component");
+ if (str != NULL)
+ component = atoi (str);
+
+ c = jingle_candidate_new (component, address, port, proto,
+ pref, ctype, user, pass, net, gen);
candidates = g_list_append (candidates, c);
}
@@ -415,11 +416,19 @@ transmit_candidates (GabbleJingleTransportGoogle *transport, GList *candidates)
for (li = candidates; li; li = li->next)
{
JingleCandidate *c = (JingleCandidate *) li->data;
- gchar port_str[16], pref_str[16], *type_str, *proto_str;
+ gchar port_str[16], pref_str[16], comp_str[16], *type_str, *proto_str;
LmMessageNode *cnode;
+ // FIXME
+ if (c->component == 2)
+ {
+ DEBUG ("ignoring RTCP component");
+ continue;
+ }
+
sprintf (port_str, "%d", c->port);
sprintf (pref_str, "%lf", c->preference);
+ sprintf (comp_str, "%d", c->component);
switch (c->type) {
case JINGLE_CANDIDATE_TYPE_LOCAL:
@@ -458,7 +467,7 @@ transmit_candidates (GabbleJingleTransportGoogle *transport, GList *candidates)
"preference", pref_str,
"protocol", proto_str,
"type", type_str,
-
+ "component", comp_str,
"name", "rtp",
"network", "0",
"generation", "0",
diff --git a/src/jingle-transport-iface.c b/src/jingle-transport-iface.c
index 55479d4..5fa10ab 100644
--- a/src/jingle-transport-iface.c
+++ b/src/jingle-transport-iface.c
@@ -149,11 +149,12 @@ gabble_jingle_transport_iface_get_type (void)
}
JingleCandidate *
-jingle_candidate_new (const gchar *address, guint port,
+jingle_candidate_new (guint component, const gchar *address, guint port,
JingleTransportProtocol proto, gdouble pref, JingleCandidateType type,
const gchar *user, const gchar *pass, guint net, guint gen)
{
JingleCandidate *c = g_slice_new0 (JingleCandidate);
+ c->component = component;
c->address = g_strdup (address);
c->port = port;
c->protocol = proto;
diff --git a/src/jingle-transport-iface.h b/src/jingle-transport-iface.h
index 90cf47b..b2c860a 100644
--- a/src/jingle-transport-iface.h
+++ b/src/jingle-transport-iface.h
@@ -68,9 +68,10 @@ void gabble_jingle_transport_iface_add_candidates (GabbleJingleTransportIface *,
void gabble_jingle_transport_iface_retransmit_candidates (GabbleJingleTransportIface *, gboolean);
GList *gabble_jingle_transport_iface_get_remote_candidates (GabbleJingleTransportIface *);
-JingleCandidate *jingle_candidate_new (const gchar *address, guint port,
- JingleTransportProtocol proto, gdouble pref, JingleCandidateType type,
- const gchar *user, const gchar *pass, guint net, guint gen);
+JingleCandidate *jingle_candidate_new (guint component, const gchar *address,
+ guint port, JingleTransportProtocol proto, gdouble pref,
+ JingleCandidateType type, const gchar *user, const gchar *pass, guint net,
+ guint gen);
void jingle_candidate_free (JingleCandidate *c);
void jingle_transport_free_candidates (GList *candidates);
diff --git a/src/media-stream.c b/src/media-stream.c
index 355dafe..0b4a86b 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -837,8 +837,10 @@ gabble_media_stream_new_native_candidate (TpSvcMediaStreamHandler *iface,
component = g_value_get_uint (g_value_array_get_nth (transport, 0));
/* Accept component 0 because old farsight1 stream-engine didn't set the
- * component
- */
+ * component */
+ if (component == 0)
+ component = 1;
+
if (component == 0 || component == 1)
{
break;
@@ -869,18 +871,21 @@ gabble_media_stream_new_native_candidate (TpSvcMediaStreamHandler *iface,
}
component_id = g_value_get_uint (g_value_array_get_nth (transport, 0));
+ /* FIXME: we're not ignoring them if dialect is videochat, or if
+ * we're not using google-p2p
if (component_id != 1)
{
DEBUG ("%s: ignoring native candidate non-1 component", G_STRFUNC);
tp_svc_media_stream_handler_return_from_new_native_candidate (context);
return;
}
+ */
g_ptr_array_add (candidates, g_value_get_boxed (&candidate));
DEBUG ("put 1 native candidate from stream-engine into cache");
- c = jingle_candidate_new (
+ c = jingle_candidate_new (component_id,
/* address */
g_value_get_string (g_value_array_get_nth (transport, 1)),
/* port */
@@ -1207,7 +1212,7 @@ new_remote_candidates_cb (GabbleJingleContent *content,
dbus_g_type_specialized_construct (transport_struct_type));
dbus_g_type_struct_set (&transport,
- 0, 1, /* component number */
+ 0, c->component,
1, c->address,
2, c->port,
3, c->protocol == JINGLE_TRANSPORT_PROTOCOL_UDP ? 0 : 1,
--
1.5.6.5
More information about the Telepathy-commits
mailing list