pidgin: b92b4735: This is a better way to handle ending on...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Jan 22 03:50:37 EST 2011


----------------------------------------------------------------------
Revision: b92b4735bd37fc251489a8cb3f4f9f1cff3e1674
Parent:   fcf72c1d92ef940bd391698c38c49edf38b93649
Author:   jakub.adam at ktknet.cz
Date:     01/22/11 03:32:31
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b92b4735bd37fc251489a8cb3f4f9f1cff3e1674

Changelog: 

This is a better way to handle ending one call when multiple calls are in
progress.  Fixes #13237.

Changes against parent fcf72c1d92ef940bd391698c38c49edf38b93649

  patched  ChangeLog
  patched  libpurple/media/backend-fs2.c
  patched  libpurple/mediamanager.c

-------------- next part --------------
============================================================
--- ChangeLog	f1de7596ebcf9dfff528a9ae32319c4a43f240d8
+++ ChangeLog	fa4fea69a3db84b490e0b9b27f25e7ebcbb02aa2
@@ -6,7 +6,7 @@ version 2.7.10 (??/??/????):
 	  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)
============================================================
--- libpurple/mediamanager.c	9819df92ea6ecba80a2bab6ed0c2061097073c10
+++ libpurple/mediamanager.c	c60fb3ce4321be346e203fcca008a0e75eed0a6e
@@ -400,7 +400,6 @@ request_pad_unlinked_cb(GstPad *pad, Gst
 	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);
 
============================================================
--- libpurple/media/backend-fs2.c	4e2b97e73f8d94fb94f6eda21941ef4ef3fdb366
+++ libpurple/media/backend-fs2.c	e7589e51803be693d1682e3a00e89569f9515fe7
@@ -155,7 +155,45 @@ purple_media_backend_fs2_init(PurpleMedi
 {
 }
 
+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)
 {
 	PurpleMediaBackendFs2Private *priv =
@@ -179,7 +217,7 @@ purple_media_backend_fs2_dispose(GObject
 					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;
 				}


More information about the Commits mailing list