cpw.maiku.media_refactor: 12e7aa33: Transfer setting Farsight 2's remote can...

maiku at pidgin.im maiku at pidgin.im
Mon Oct 26 22:45:47 EDT 2009


-----------------------------------------------------------------
Revision: 12e7aa33ad23347505dc5cb1aaaac0670de75ef8
Ancestor: e61e6fe7b161ad84db4103627e3d012f3e78c1d4
Author: maiku at pidgin.im
Date: 2009-10-26T22:14:25
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/12e7aa33ad23347505dc5cb1aaaac0670de75ef8

Modified files:
        libpurple/media/backend-fs2.c libpurple/media/media.c

ChangeLog: 

Transfer setting Farsight 2's remote candidates to the Fs2 media backend.

-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c	8f61b5014986026c859a0c7495d9107eec85870e
+++ libpurple/media/backend-fs2.c	81746e66610263ca39fa09f465ba5c21ddf7463b
@@ -381,9 +381,10 @@ _session_type_from_fs(FsMediaType type, 
 	}
 	return result;
 }
+#endif
 
 static FsCandidate *
-purple_media_candidate_to_fs(PurpleMediaCandidate *candidate)
+_candidate_to_fs(PurpleMediaCandidate *candidate)
 {
 	FsCandidate *fscandidate;
 	gchar *foundation;
@@ -432,8 +433,21 @@ purple_media_candidate_to_fs(PurpleMedia
 	g_free(ip);
 	return fscandidate;
 }
-#endif
 
+static GList *
+_candidate_list_to_fs(GList *candidates)
+{
+	GList *new_list = NULL;
+
+	for (; candidates; candidates = g_list_next(candidates)) {
+		new_list = g_list_prepend(new_list,
+				_candidate_to_fs(candidates->data));
+	}
+
+	new_list = g_list_reverse(new_list);
+	return new_list;
+}
+
 static PurpleMediaCandidate *
 purple_media_candidate_from_fs(FsCandidate *fscandidate)
 {
@@ -1232,6 +1246,38 @@ purple_media_backend_fs2_add_remote_cand
 		const gchar *sess_id, const gchar *participant,
 		GList *remote_candidates)
 {
+	PurpleMediaBackendFs2Private *priv;
+	PurpleMediaBackendFs2Stream *stream;
+	GError *err = NULL;
+
+	g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
+
+	priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
+	stream = _get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
+			sess_id, participant);
+
+	if (stream == NULL) {
+		purple_debug_error("backend-fs2",
+				"purple_media_add_remote_candidates: "
+				"couldn't find stream %s %s.\n",
+				sess_id ? sess_id : "(null)",
+				participant ? participant : "(null)");
+		return;
+	}
+
+	stream->remote_candidates = g_list_concat(stream->remote_candidates,
+			_candidate_list_to_fs(remote_candidates));
+
+	if (purple_media_accepted(priv->media, sess_id, participant)) {
+		fs_stream_set_remote_candidates(stream->stream,
+				stream->remote_candidates, &err);
+
+		if (err) {
+			purple_debug_error("backend-fs2", "Error adding remote"
+					" candidates: %s\n", err->message);
+			g_error_free(err);
+		}
+	}
 }
 
 static GList *
============================================================
--- libpurple/media/media.c	6ea2a15bccf6748327028a9ad6a6bd2125da7ccc
+++ libpurple/media/media.c	4ed9c2247de11491e6c5079cb45ff006c1fd5ae6
@@ -1531,7 +1531,6 @@ purple_media_add_remote_candidates(Purpl
 {
 #ifdef USE_VV
 	PurpleMediaStream *stream;
-	GError *err = NULL;
 
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	stream = purple_media_get_stream(media, sess_id, participant);
@@ -1549,17 +1548,9 @@ purple_media_add_remote_candidates(Purpl
 			purple_media_candidate_list_copy(remote_candidates));
 
 	if (stream->accepted == TRUE) {
-		GList *candidates = purple_media_candidate_list_to_fs(
-				stream->remote_candidates);
-		fs_stream_set_remote_candidates(stream->stream,
-				candidates, &err);
-		fs_candidate_list_destroy(candidates);
-
-		if (err) {
-			purple_debug_error("media", "Error adding remote"
-					" candidates: %s\n", err->message);
-			g_error_free(err);
-		}
+		purple_media_backend_add_remote_candidates(
+				media->priv->backend, sess_id, participant,
+				remote_candidates);
 	}
 #endif
 }


More information about the Commits mailing list