cpw.maiku.media_refactor: 80a79eeb: Move get_local_candidates functionality ...

maiku at pidgin.im maiku at pidgin.im
Mon Oct 26 22:46:10 EDT 2009


-----------------------------------------------------------------
Revision: 80a79eeb954ad710b7090fa8d0f6ce4afa3db9d3
Ancestor: 9187cf79f4f006b57d4f22db2f8c21c1c554cd91
Author: maiku at pidgin.im
Date: 2009-10-26T22:50:23
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/80a79eeb954ad710b7090fa8d0f6ce4afa3db9d3

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

ChangeLog: 

Move get_local_candidates functionality over to the Fs2 media backend.

-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c	d2fda032c72b77152f591f11f07fa0d2f44d0a0d
+++ libpurple/media/backend-fs2.c	1b270d5b9e4f6c51cfd32b7d61438930c0583da7
@@ -467,6 +467,20 @@ _candidate_from_fs(FsCandidate *fscandid
 	return candidate;
 }
 
+static GList *
+_candidate_list_from_fs(GList *candidates)
+{
+	GList *new_list = NULL;
+
+	for (; candidates; candidates = g_list_next(candidates)) {
+		new_list = g_list_prepend(new_list,
+			_candidate_from_fs(candidates->data));
+	}
+
+	new_list = g_list_reverse(new_list);
+	return new_list;
+}
+
 #if 0
 static FsCodec *
 _codec_to_fs(const PurpleMediaCodec *codec)
@@ -705,6 +719,7 @@ _gst_handle_message_element(GstBus *bus,
 		PurpleMediaCandidate *candidate;
 		FsParticipant *participant;
 		PurpleMediaBackendFs2Session *session;
+		PurpleMediaBackendFs2Stream *media_stream;
 		gchar *name;
 
 		value = gst_structure_get_value(msg->structure, "stream");
@@ -722,10 +737,10 @@ _gst_handle_message_element(GstBus *bus,
 		g_object_get(participant, "cname", &name, NULL);
 		g_object_unref(participant);
 
-#if 0
-		purple_media_insert_local_candidate(session, name,
+		media_stream = _get_stream(self, session->id, name);
+		media_stream->local_candidates = g_list_append(
+				media_stream->local_candidates,
 				fs_candidate_copy(local_candidate));
-#endif
 
 		candidate = _candidate_from_fs(local_candidate);
 		g_signal_emit_by_name(self, "new-candidate",
@@ -1401,7 +1416,18 @@ purple_media_backend_fs2_get_local_candi
 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
 		const gchar *sess_id, const gchar *participant)
 {
-	return NULL;
+	PurpleMediaBackendFs2Stream *stream;
+	GList *candidates = NULL;
+
+	g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
+
+	stream = _get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
+			sess_id, participant);
+
+	if (stream != NULL)
+		candidates = _candidate_list_from_fs(
+				stream->local_candidates);
+	return candidates;
 }
 
 static void
============================================================
--- libpurple/media/media.c	e057db519e0242489955c573b8a46dbf80037c5f
+++ libpurple/media/media.c	d3dd1422e736937fabd525adcc3f183d9b40e0d6
@@ -1503,11 +1503,10 @@ purple_media_get_local_candidates(Purple
                                   const gchar *participant)
 {
 #ifdef USE_VV
-	PurpleMediaStream *stream;
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
-	stream = purple_media_get_stream(media, sess_id, participant);
-	return stream ? purple_media_candidate_list_copy(
-			stream->local_candidates) : NULL;
+
+	return purple_media_backend_get_local_candidates(media->priv->backend,
+			sess_id, participant);
 #else
 	return NULL;
 #endif


More information about the Commits mailing list