pidgin.vv: 86842423: Fix some crashes from printing debug mes...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sun Jan 11 21:46:35 EST 2009


-----------------------------------------------------------------
Revision: 868424234ef3f596f3f0d96fc4b518876f960790
Ancestor: 393df5675351df3da215dcd5417a1f2415af760f
Author: maiku at soc.pidgin.im
Date: 2009-01-12T02:42:29
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/868424234ef3f596f3f0d96fc4b518876f960790

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

ChangeLog: 

Fix some crashes from printing debug messages on a separate thread.

-------------- next part --------------
============================================================
--- libpurple/media.c	66e480ab8ae84a799a0d5077775410e4a36c3c46
+++ libpurple/media.c	5641290642a77b83ce85d3de3ca7b24085c19c9e
@@ -1459,8 +1459,6 @@ purple_media_audio_init_src(GstElement *
 	const gchar *audio_device = purple_prefs_get_string("/purple/media/audio/device");
 	double input_volume = purple_prefs_get_int("/purple/media/audio/volume/input")/10.0;
 
-	purple_debug_info("media", "purple_media_audio_init_src\n");
-
 	*sendbin = gst_bin_new("purplesendaudiobin");
 	src = gst_element_factory_make("alsasrc", "asrc");
 	volume = gst_element_factory_make("volume", "purpleaudioinputvolume");
@@ -1489,8 +1487,6 @@ purple_media_video_init_src(GstElement *
 	const gchar *video_device = purple_prefs_get_string(
 			"/purple/media/video/device");
 
-	purple_debug_info("media", "purple_media_video_init_src\n");
-
 	*sendbin = gst_bin_new("purplesendvideobin");
 	src = gst_element_factory_make(video_plugin, "purplevideosource");
 	gst_bin_add(GST_BIN(*sendbin), src);
@@ -1533,8 +1529,6 @@ purple_media_audio_init_recv(GstElement 
 	double output_volume = purple_prefs_get_int(
 			"/purple/media/audio/volume/output")/10.0;
 
-	purple_debug_info("media", "purple_media_audio_init_recv\n");
-
 	*recvbin = gst_bin_new("pidginrecvaudiobin");
 	sink = gst_element_factory_make("alsasink", "asink");
 	g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
@@ -1548,8 +1542,6 @@ purple_media_audio_init_recv(GstElement 
 	ghost = gst_ghost_pad_new("ghostsink", pad);
 	gst_element_add_pad(*recvbin, ghost);
 	g_object_set(G_OBJECT(*recvlevel), "message", TRUE, NULL);
-
-	purple_debug_info("media", "purple_media_audio_init_recv end\n");
 }
 
 void
@@ -1558,16 +1550,12 @@ purple_media_video_init_recv(GstElement 
 	GstElement *sink;
 	GstPad *pad, *ghost;
 
-	purple_debug_info("media", "purple_media_video_init_recv\n");
-
 	*recvbin = gst_bin_new("pidginrecvvideobin");
 	sink = gst_element_factory_make("autovideosink", "purplevideosink");
 	gst_bin_add(GST_BIN(*recvbin), sink);
 	pad = gst_element_get_pad(sink, "sink");
 	ghost = gst_ghost_pad_new("ghostsink", pad);
 	gst_element_add_pad(*recvbin, ghost);
-
-	purple_debug_info("media", "purple_media_video_init_recv end\n");
 }
 
 static void
@@ -1647,6 +1635,16 @@ purple_media_candidate_pair_established_
 	purple_media_candidate_free(remote);
 }
 
+static gboolean
+purple_media_connected_cb(PurpleMediaStream *stream)
+{
+	g_signal_emit(stream->session->media,
+			purple_media_signals[STATE_CHANGED],
+			0, PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
+			stream->session->id, stream->participant);
+	return FALSE;
+}
+
 static void
 purple_media_src_pad_added_cb(FsStream *fsstream, GstPad *srcpad,
 			      FsCodec *codec, PurpleMediaStream *stream)
@@ -1660,13 +1658,10 @@ purple_media_src_pad_added_cb(FsStream *
 	gst_bin_add(GST_BIN(purple_media_get_pipeline(stream->session->media)),
 		    stream->sink);
 	sinkpad = gst_element_get_static_pad(stream->sink, "ghostsink");
-	purple_debug_info("media", "connecting new src pad: %s\n", 
-			  gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK ? "success" : "failure");
+	gst_pad_link(srcpad, sinkpad);
 	gst_element_set_state(stream->sink, GST_STATE_PLAYING);
 
-	g_signal_emit(stream->session->media, purple_media_signals[STATE_CHANGED],
-				0, PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
-				stream->session->id, stream->participant);
+	g_timeout_add(0, (GSourceFunc)purple_media_connected_cb, stream);
 }
 
 static gchar *
============================================================
--- pidgin/gtkmedia.c	a01bb89a130dbc8582ef1cb7fa25e192aa6660c2
+++ pidgin/gtkmedia.c	3784f8db846aedcd337587b3d5348da4768dd2ff
@@ -337,7 +337,6 @@ create_window (GstBus *bus, GstMessage *
 		return TRUE;
 
 	name = gst_object_get_name(GST_MESSAGE_SRC (message));
-	purple_debug_info("gtkmedia", "prepare-xwindow-id object name: %s\n", name);
 
 	/* The XOverlay's name is the sink's name with a suffix */
 	if (!strncmp(name, "purplevideosink", strlen("purplevideosink")))


More information about the Commits mailing list