pidgin.vv: 6f6a810b: Handle the session tee in the session ra...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sat Feb 21 02:25:35 EST 2009


-----------------------------------------------------------------
Revision: 6f6a810b0411a1e2b7a1bba79dae2b02ea200d19
Ancestor: 2cfec44eab47ae1c036175917cfad57d844a7002
Author: maiku at soc.pidgin.im
Date: 2009-02-21T05:01:10
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/6f6a810b0411a1e2b7a1bba79dae2b02ea200d19

Modified files:
        libpurple/media.c

ChangeLog: 

Handle the session tee in the session rather than the src bin.

-------------- next part --------------
============================================================
--- libpurple/media.c	4d846ec3e4a4620efcba6f1b6bcf8a8b057a196e
+++ libpurple/media.c	9c3c5a8bcdddcaa259986b067a306a009bacbb4b
@@ -52,6 +52,7 @@ struct _PurpleMediaSession
 	gchar *id;
 	PurpleMedia *media;
 	GstElement *src;
+	GstElement *tee;
 	FsSession *session;
 
 	PurpleMediaSessionType type;
@@ -1106,8 +1107,13 @@ purple_media_set_src(PurpleMedia *media,
 	gst_bin_add(GST_BIN(session->media->priv->confbin),
 		    session->src);
 
+	session->tee = gst_element_factory_make("tee", NULL);
+	gst_bin_add(GST_BIN(session->media->priv->confbin), session->tee);
+	gst_element_link(session->src, session->tee);
+	gst_element_set_state(session->tee, GST_STATE_PLAYING);
+
 	g_object_get(session->session, "sink-pad", &sinkpad, NULL);
-	srcpad = gst_element_get_static_pad(src, "ghostsrc");
+	srcpad = gst_element_get_request_pad(session->tee, "src%d");
 	purple_debug_info("media", "connecting pad: %s\n", 
 			  gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
 			  ? "success" : "failure");
@@ -1545,7 +1551,7 @@ purple_media_video_init_src(GstElement *
 void
 purple_media_video_init_src(GstElement **sendbin)
 {
-	GstElement *src, *tee, *queue;
+	GstElement *src;
 	GstPad *pad;
 	GstPad *ghost;
 	const gchar *video_plugin = purple_prefs_get_string(
@@ -1559,20 +1565,12 @@ purple_media_video_init_src(GstElement *
 	src = gst_element_factory_make(video_plugin, "purplevideosource");
 	gst_bin_add(GST_BIN(*sendbin), src);
 
-	tee = gst_element_factory_make("tee", "purplevideosrctee");
-	gst_bin_add(GST_BIN(*sendbin), tee);
-	gst_element_link(src, tee);
-
-	queue = gst_element_factory_make("queue", NULL);
-	gst_bin_add(GST_BIN(*sendbin), queue);
-	gst_element_link(tee, queue);
-
 	if (!strcmp(video_plugin, "videotestsrc")) {
 		/* unless is-live is set to true it doesn't throttle videotestsrc */
 		g_object_set (G_OBJECT(src), "is-live", TRUE, NULL);
 	}
 
-	pad = gst_element_get_static_pad(queue, "src");
+	pad = gst_element_get_static_pad(src, "src");
 	ghost = gst_ghost_pad_new("ghostsrc", pad);
 	gst_object_unref(pad);
 	gst_element_add_pad(*sendbin, ghost);
@@ -2358,15 +2356,14 @@ purple_media_set_output_window(PurpleMed
 		if (session->sink == NULL) {
 			PurpleMediaXOverlayData *data;
 			GstBus *bus;
-			GstElement *tee, *bin, *queue, *sink;
+			GstElement *bin, *queue, *sink;
 			GstPad *request_pad, *sinkpad, *ghostpad;
 			gchar *name;
 
 			/* Create sink */
-			tee = gst_bin_get_by_name(GST_BIN(session->src),
-					"purplevideosrctee");
 			bin = gst_bin_new(NULL);
-			gst_bin_add(GST_BIN(GST_ELEMENT_PARENT(tee)), bin);
+			gst_bin_add(GST_BIN(GST_ELEMENT_PARENT(
+					session->tee)), bin);
 
 			queue = gst_element_factory_make("queue", NULL);
 			name = g_strdup_printf(
@@ -2398,7 +2395,7 @@ purple_media_set_output_window(PurpleMed
 			gst_element_set_state(bin, GST_STATE_PLAYING);
 
 			request_pad = gst_element_get_request_pad(
-					tee, "src%d");
+					session->tee, "src%d");
 			gst_pad_link(request_pad, ghostpad);
 			gst_object_unref(request_pad);
 


More information about the Commits mailing list