changeset 31600:66fe4bda9a85

This is a better way to handle ending one call when multiple calls are in progress. Fixes #13237. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author jakub.adam@ktknet.cz
date Sat, 22 Jan 2011 08:32:31 +0000
parents 34da321b60f1
children 2b63df6e495c
files ChangeLog libpurple/media/backend-fs2.c libpurple/mediamanager.c
diffstat 3 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jan 20 06:43:45 2011 +0000
+++ b/ChangeLog	Sat Jan 22 08:32:31 2011 +0000
@@ -6,7 +6,7 @@
 	  number of times video must be scaled down, saving CPU time. (Jakub Adam)
 	  (half of #13095)
 	* Starting multiple video calls and ending one no longer causes the other
-	  calls to stop sending audio and video. (Jakub Adam) (#12758)
+	  calls to stop sending audio and video. (Jakub Adam) (#12758, #13237)
 	* Perl bindings now respect LDFLAGS. (Peter Volkov, Markos Chandras)
 	  (#12638)
 	* Added AddTrust External Root CA.  (#11554)
--- a/libpurple/media/backend-fs2.c	Thu Jan 20 06:43:45 2011 +0000
+++ b/libpurple/media/backend-fs2.c	Sat Jan 22 08:32:31 2011 +0000
@@ -155,6 +155,44 @@
 {
 }
 
+static gboolean
+event_probe_cb(GstPad *srcpad, GstEvent *event, gboolean release_pad)
+{
+	if (GST_EVENT_TYPE(event) == GST_EVENT_CUSTOM_DOWNSTREAM
+		&& gst_event_has_name(event, "purple-unlink-tee")) {
+
+		const GstStructure *s = gst_event_get_structure(event);
+
+		gst_pad_unlink(srcpad, gst_pad_get_peer(srcpad));
+
+		gst_pad_remove_event_probe(srcpad,
+			g_value_get_uint(gst_structure_get_value(s, "handler-id")));
+
+		if (g_value_get_boolean(gst_structure_get_value(s, "release-pad")))
+			gst_element_release_request_pad(GST_ELEMENT_PARENT(srcpad), srcpad);
+
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void
+unlink_teepad_dynamic(GstPad *srcpad, gboolean release_pad)
+{
+	guint id = gst_pad_add_event_probe(srcpad, G_CALLBACK(event_probe_cb), NULL);
+
+	if (GST_IS_GHOST_PAD(srcpad))
+		srcpad = gst_ghost_pad_get_target(GST_GHOST_PAD(srcpad));
+
+	gst_element_send_event(gst_pad_get_parent_element(srcpad),
+		gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM,
+			gst_structure_new("purple-unlink-tee",
+				"release-pad", G_TYPE_BOOLEAN, release_pad,
+				"handler-id", G_TYPE_UINT, id,
+				NULL)));
+}
+
 static void
 purple_media_backend_fs2_dispose(GObject *obj)
 {
@@ -179,7 +217,7 @@
 					g_list_delete_link(sessions, sessions)) {
 				PurpleMediaBackendFs2Session *session = sessions->data;
 				if (session->srcpad) {
-					gst_pad_set_blocked(session->srcpad, TRUE);
+					unlink_teepad_dynamic(session->srcpad, FALSE);
 					gst_object_unref(session->srcpad);
 					session->srcpad = NULL;
 				}
--- a/libpurple/mediamanager.c	Thu Jan 20 06:43:45 2011 +0000
+++ b/libpurple/mediamanager.c	Sat Jan 22 08:32:31 2011 +0000
@@ -400,7 +400,6 @@
 	GstIteratorResult result;
 
 	gst_element_release_request_pad(GST_ELEMENT_PARENT(pad), pad);
-	gst_pad_set_blocked(pad, FALSE);
 
 	iter = gst_element_iterate_src_pads(parent);