cpw.maiku.media_refactor: 9d59218f: Move handling Farsight 2's codecs-change...

maiku at pidgin.im maiku at pidgin.im
Fri Oct 23 22:10:33 EDT 2009


-----------------------------------------------------------------
Revision: 9d59218f424b8b28e24d254faeaabfca5a4f139a
Ancestor: 3cb3c9654737630864caac6622dc07f4f985d484
Author: maiku at pidgin.im
Date: 2009-10-23T23:12:57
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/9d59218f424b8b28e24d254faeaabfca5a4f139a

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

ChangeLog: 

Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.

-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c	8da15c615a8f7f42309b607beed6540c88f6d0d8
+++ libpurple/media/backend-fs2.c	43dbba00369e876a447b35a5112f96958810e91d
@@ -663,13 +663,10 @@ _gst_handle_message_element(GstBus *bus,
 			"farsight-codecs-changed")) {
 		const GValue *value;
 		FsSession *fssession;
-#if 0
 		GList *sessions;
-#endif
 
 		value = gst_structure_get_value(msg->structure, "session");
 		fssession = g_value_get_object(value);
-#if 0
 		sessions = g_hash_table_get_values(priv->sessions);
 
 		for (; sessions; sessions =
@@ -681,14 +678,12 @@ _gst_handle_message_element(GstBus *bus,
 				continue;
 
 			session_id = g_strdup(session->id);
-			g_signal_emit(media,
-					purple_media_backend_fs2_signals[
-					CODECS_CHANGED], 0, session_id);
+			g_signal_emit_by_name(self, "codecs-changed",
+					session_id);
 			g_free(session_id);
 			g_list_free(sessions);
 			break;
 		}
-#endif
 	}
 }
 
============================================================
--- libpurple/media/media.c	d4b27fa190500afc7a95b19e998047f4eb7516a9
+++ libpurple/media/media.c	f05a31977e1514595a3d6542c5a868c906287e5c
@@ -146,6 +146,8 @@ static void purple_media_candidate_pair_
 static void purple_media_candidate_pair_established_cb(FsStream *stream,
 		FsCandidate *native_candidate, FsCandidate *remote_candidate,
 		PurpleMediaSession *session);
+static void purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
+		const gchar *sess_id, PurpleMedia *media);
 static gboolean media_bus_call(GstBus *bus,
 		GstMessage *msg, PurpleMedia *media);
 
@@ -440,6 +442,11 @@ purple_media_set_property (GObject *obje
 					"media", media,
 					NULL);
 			g_signal_connect(media->priv->backend,
+					"codecs-changed",
+					G_CALLBACK(
+					purple_media_codecs_changed_cb),
+					media);
+			g_signal_connect(media->priv->backend,
 					"new-candidate",
 					G_CALLBACK(
 					purple_media_new_local_candidate_cb),
@@ -1072,20 +1079,6 @@ media_bus_call(GstBus *bus, GstMessage *
 				FsCandidate *remote_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "remote-candidate"));
 				PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
 				purple_media_candidate_pair_established_cb(stream, local_candidate, remote_candidate, session);
-			} else if (gst_structure_has_name(msg->structure,
-					"farsight-codecs-changed")) {
-				GList *sessions = g_hash_table_get_values(PURPLE_MEDIA(media)->priv->sessions);
-				FsSession *fssession = g_value_get_object(gst_structure_get_value(msg->structure, "session"));
-				for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
-					PurpleMediaSession *session = sessions->data;
-					if (session->session == fssession) {
-						gchar *session_id = g_strdup(session->id);
-						g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, session_id);
-						g_free(session_id);
-						g_list_free(sessions);
-						break;
-					}
-				}
 			}
 			break;
 		}
@@ -1362,6 +1355,13 @@ purple_media_candidate_pair_established_
 	purple_debug_info("media", "candidate pair established\n");
 }
 
+static void
+purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
+		const gchar *sess_id, PurpleMedia *media)
+{
+	g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, sess_id);
+}
+
 static gboolean
 purple_media_connected_cb(PurpleMediaStream *stream)
 {


More information about the Commits mailing list