soc.2008.vv: 18d8536f: Move the main voice and video pipeline i...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Jun 27 14:10:58 EDT 2008


-----------------------------------------------------------------
Revision: 18d8536f88c380d0204a943194945894a9adf195
Ancestor: 63fa5ac428a18e30aace8abd861c361b97a356bb
Author: maiku at soc.pidgin.im
Date: 2008-06-27T16:56:25
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/18d8536f88c380d0204a943194945894a9adf195

Modified files:
        libpurple/media.c pidgin/gtkmedia.c

ChangeLog: 

Move the main voice and video pipeline into media.c and display more debug info.

-------------- next part --------------
============================================================
--- libpurple/media.c	6baab475a93fbf18033bd094da2eb440473f79b2
+++ libpurple/media.c	d79242e7085b7fe194aab3f23d0a3b2516d9d5bf
@@ -490,11 +490,66 @@ purple_media_get_sink(PurpleMedia *media
 	return purple_media_get_session(media, sess_id)->src;
 }
 
+static gboolean
+media_bus_call(GstBus *bus, GstMessage *msg, gpointer media)
+{
+	switch(GST_MESSAGE_TYPE(msg)) {
+		case GST_MESSAGE_EOS:
+			purple_debug_info("media", "End of Stream\n");
+			break;
+		case GST_MESSAGE_ERROR: {
+			gchar *debug = NULL;
+			GError *err = NULL;
+
+			gst_message_parse_error(msg, &err, &debug);
+
+			purple_debug_error("media", "gst pipeline error: %s\n", err->message);
+			g_error_free(err);
+
+			if (debug) {
+				purple_debug_error("media", "Debug details: %s\n", debug);
+				g_free (debug);
+			}
+			break;
+		}
+		case GST_MESSAGE_ELEMENT: {
+			if (gst_structure_has_name(msg->structure, "farsight-error")) {
+				gint error_no;
+				gst_structure_get_int(msg->structure, "error-no", &error_no);
+				purple_debug_error("media", "farsight-error: %i: %s\n", error_no,
+						  gst_structure_get_string(msg->structure, "error-msg"));
+			} else {
+				gchar *name, *str;
+				name = gst_object_get_name(GST_MESSAGE_SRC (msg));
+				purple_debug_info("media", "element name: %s\n", name);
+				g_free(name);
+
+				str = gst_structure_to_string(msg->structure);
+				purple_debug_info("media", "structure: %s\n", str);
+				g_free(str);
+			}
+			break;
+		}
+		default:
+			purple_debug_info("media", "gst message type: %s\n",
+					  GST_MESSAGE_TYPE_NAME(msg));
+			return TRUE;
+	}
+
+	return TRUE;
+}
+
 GstElement *
 purple_media_get_pipeline(PurpleMedia *media)
 {
 	if (!media->priv->pipeline) {
+		GstBus *bus;
 		media->priv->pipeline = gst_pipeline_new(media->priv->name);
+		bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
+		gst_bus_add_signal_watch(GST_BUS(bus));
+		gst_bus_add_watch(bus, media_bus_call, media);
+		gst_object_unref(bus);
+
 		gst_bin_add(GST_BIN(media->priv->pipeline), GST_ELEMENT(media->priv->conference));
 	}
 
============================================================
--- pidgin/gtkmedia.c	a7c293250b7aff1b723d2bc589490d97ffe0e982
+++ pidgin/gtkmedia.c	12a7bdedece47f9a23b0b5b34da338fb0fb0b691
@@ -261,36 +261,6 @@ static gboolean
 }
 
 static gboolean
-media_bus_call(GstBus *bus, GstMessage *msg, gpointer gtkmedia)
-{
-	switch(GST_MESSAGE_TYPE(msg)) {
-		case GST_MESSAGE_EOS:
-			purple_debug_info("gtkmedia", "End of Stream\n");
-			break;
-		case GST_MESSAGE_ERROR: {
-			gchar *debug = NULL;
-			GError *err = NULL;
-
-			gst_message_parse_error(msg, &err, &debug);
-
-			purple_debug_error("gtkmedia", "gst pipeline error: %s\n", err->message);
-			g_error_free(err);
-
-			if (debug) {
-				purple_debug_error("gtkmedia", "Debug details: %s\n", debug);
-				g_free (debug);
-			}
-			break;
-		}
-		default:
-			purple_debug_info("gtkmedia", "gst message type: %i\n", GST_MESSAGE_TYPE(msg));
-			return TRUE;
-	}
-
-	return TRUE;
-}
-
-static gboolean
 create_window (GstBus *bus, GstMessage *message, PidginMedia *gtkmedia)
 {
 	char *name;
@@ -422,7 +392,6 @@ pidgin_media_ready_cb(PurpleMedia *media
 			 "message", G_CALLBACK(level_message_cb), gtkmedia);
 	if (videorecvbin || videosendbin)
 		gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia);
-	gst_bus_add_watch(bus, media_bus_call, gtkmedia);
 	gst_object_unref(bus);
 }
 


More information about the Commits mailing list