changeset 26299:d784e9ea7f50

Implement jingle_rtp_candidates_prepared_cb.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 19 Mar 2009 09:46:37 +0000
parents b892b3cb9dbc
children 7fe896a5f4db
files libpurple/protocols/jabber/jingle/rtp.c
diffstat 1 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rtp.c	Thu Mar 19 09:30:16 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Thu Mar 19 09:46:37 2009 +0000
@@ -343,9 +343,38 @@
 }
 
 static void
-jingle_rtp_candidates_prepared_cb(PurpleMedia *media, gchar *sid, gchar *name)
+jingle_rtp_candidates_prepared_cb(PurpleMedia *media,
+		gchar *sid, gchar *name, JingleSession *session)
 {
+	JingleContent *content = jingle_session_find_content(
+			session, sid, "initiator");
+	JingleTransport *oldtransport, *transport;
+	GList *candidates;
+
 	purple_debug_info("jingle-rtp", "jingle_rtp_candidates_prepared_cb\n");
+
+	if (content == NULL)
+		jingle_session_find_content(session, sid, "responder");
+
+	if (content == NULL) {
+		purple_debug_error("jingle-rtp",
+				"jingle_rtp_candidates_prepared_cb: "
+				"Can't find session %s\n", sid);
+		return;
+	}
+
+	oldtransport = jingle_content_get_transport(content);
+	candidates = purple_media_get_local_candidates(media, sid, name);
+	transport = JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport(
+			session, JINGLE_IS_RAWUDP(oldtransport) ?
+				JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP,
+			0, candidates));
+
+	g_list_free(candidates);
+	g_object_unref(oldtransport);
+
+	jingle_content_set_pending_transport(content, transport);
+	jingle_content_accept_transport(content);
 }
 
 static void
@@ -425,20 +454,6 @@
 			g_signal_connect(G_OBJECT(media), "new-candidate",
 					 G_CALLBACK(jingle_rtp_new_candidate_cb), session);
 		}
-	} else if (sid != NULL && name != NULL) {
-		JingleContent *content = jingle_session_find_content(session, sid, "initiator");
-		JingleTransport *oldtransport = jingle_content_get_transport(content);
-		GList *candidates = purple_media_get_local_candidates(media, sid, name);
-		JingleTransport *transport =
-				JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport(
-				session, JINGLE_IS_RAWUDP(oldtransport) ?
-					JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP,
-				0, candidates));
-		g_list_free(candidates);
-		g_object_unref(oldtransport);
-
-		jingle_content_set_pending_transport(content, transport);
-		jingle_content_accept_transport(content);
 	}
 }