[telepathy-gabble/master] Update Jingle{Content, Session} to new Transport API
Will Thompson
will.thompson at collabora.co.uk
Sat Jun 27 04:09:08 PDT 2009
This ensures that inject_candidates and send_candidates are called at
all the appropriate moments, to give the transports the opportunities to
do what they need to do. Those appropriate moments are:
inject_candidates: when sending session-initiate, session-accept,
content-add, content-accept.
send_candidates: just after any of the above actions (for transports
that never include candidates in the actions and always send
transport-info), and when candidates are added for contents which have
already been announced.
---
src/jingle-content.c | 43 ++++++++++++++++++++++---------------------
src/jingle-content.h | 2 ++
src/jingle-session.c | 5 ++++-
3 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/src/jingle-content.c b/src/jingle-content.c
index 0cd2482..dfc6e53 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -36,10 +36,6 @@
#include "namespaces.h"
#include "util.h"
-/* FIXME: need this because rawudp_produce_candidate isn't
- * virtual method on transport ifaceyet */
-#include "jingle-transport-rawudp.h"
-
/* signal enum */
enum
{
@@ -712,18 +708,6 @@ gabble_jingle_content_produce_node (GabbleJingleContent *c,
if (trans_node_out != NULL)
*trans_node_out = trans_node;
}
-
- /* FIXME: We need to special-case rawudp here to include the
- * candidate in session initiation, until we make a generic
- * virtual method for adding transport nodes. This adds a second <transport>
- * node...
- */
- if (!tp_strdiff (priv->transport_ns, NS_JINGLE_TRANSPORT_RAWUDP))
- {
- jingle_transport_rawudp_produce_candidate (
- GABBLE_JINGLE_TRANSPORT_RAWUDP(priv->transport),
- content_node);
- }
}
void
@@ -770,6 +754,12 @@ gabble_jingle_content_add_candidates (GabbleJingleContent *self, GList *li)
/* Maybe we were waiting for at least one candidate? */
_maybe_ready (self);
}
+
+ /* If the content exists on the wire, let the transport send this candidate
+ * if it wants to.
+ */
+ if (priv->state > JINGLE_CONTENT_STATE_EMPTY)
+ gabble_jingle_transport_iface_send_candidates (priv->transport, FALSE);
}
/* Returns whether the content is ready to be signalled (initiated, for local
@@ -817,7 +807,7 @@ send_content_add_or_accept (GabbleJingleContent *self)
{
GabbleJingleContentPrivate *priv = self->priv;
LmMessage *msg;
- LmMessageNode *sess_node;
+ LmMessageNode *sess_node, *transport_node;
JingleAction action;
JingleContentState new_state = JINGLE_CONTENT_STATE_EMPTY;
@@ -841,7 +831,10 @@ send_content_add_or_accept (GabbleJingleContent *self)
msg = gabble_jingle_session_new_message (self->session,
action, &sess_node);
- gabble_jingle_content_produce_node (self, sess_node, TRUE, TRUE, NULL);
+ gabble_jingle_content_produce_node (self, sess_node, TRUE, TRUE,
+ &transport_node);
+ gabble_jingle_transport_iface_inject_candidates (priv->transport,
+ transport_node);
gabble_jingle_session_send (self->session, msg, NULL, NULL);
priv->state = new_state;
@@ -879,7 +872,7 @@ _maybe_ready (GabbleJingleContent *self)
send_content_add_or_accept (self);
/* if neccessary, transmit the candidates */
- gabble_jingle_transport_iface_retransmit_candidates (priv->transport,
+ gabble_jingle_transport_iface_send_candidates (priv->transport,
FALSE);
}
else
@@ -926,10 +919,18 @@ void
gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self,
gboolean all)
{
- gabble_jingle_transport_iface_retransmit_candidates (self->priv->transport,
- all);
+ gabble_jingle_transport_iface_send_candidates (self->priv->transport, all);
+}
+
+void
+gabble_jingle_content_inject_candidates (GabbleJingleContent *self,
+ LmMessageNode *transport_node)
+{
+ gabble_jingle_transport_iface_inject_candidates (self->priv->transport,
+ transport_node);
}
+
/* Called by a subclass when the media is ready (e.g. we got local codecs) */
void
_gabble_jingle_content_set_media_ready (GabbleJingleContent *self)
diff --git a/src/jingle-content.h b/src/jingle-content.h
index 3335cb8..50d26f6 100644
--- a/src/jingle-content.h
+++ b/src/jingle-content.h
@@ -124,6 +124,8 @@ gboolean gabble_jingle_content_change_direction (GabbleJingleContent *c,
JingleContentSenders senders);
void gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self,
gboolean all);
+void gabble_jingle_content_inject_candidates (GabbleJingleContent *self,
+ LmMessageNode *transport_node);
gboolean gabble_jingle_content_is_created_by_us (GabbleJingleContent *c);
gboolean gabble_jingle_content_creator_is_initiator (GabbleJingleContent *c);
diff --git a/src/jingle-session.c b/src/jingle-session.c
index 1a7a1af..4182cad 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -1669,9 +1669,12 @@ _fill_content (GabbleJingleSession *sess,
GabbleJingleContent *c, gpointer user_data)
{
LmMessageNode *sess_node = user_data;
+ LmMessageNode *transport_node;
JingleContentState state;
- gabble_jingle_content_produce_node (c, sess_node, TRUE, TRUE, NULL);
+ gabble_jingle_content_produce_node (c, sess_node, TRUE, TRUE,
+ &transport_node);
+ gabble_jingle_content_inject_candidates (c, transport_node);
g_object_get (c, "state", &state, NULL);
--
1.5.6.5
More information about the telepathy-commits
mailing list