/pidgin/main: 8e4fa54f1662: media: ensure nonunique source is re...

Jakub Adam jakub.adam at ktknet.cz
Fri Mar 13 19:52:07 EDT 2015


Changeset: 8e4fa54f166211ffd6cd869cca611e8d64ea1fdf
Author:	 Jakub Adam <jakub.adam at ktknet.cz>
Date:	 2014-10-02 23:46 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/8e4fa54f1662

Description:

media: ensure nonunique source is removed from pipeline when unlinked

diffstat:

 libpurple/mediamanager.c |  14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diffs (31 lines):

diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -443,6 +443,16 @@ request_pad_unlinked_cb(GstPad *pad, Gst
 
 	gst_iterator_free(iter);
 }
+
+static void
+nonunique_src_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data)
+{
+	GstElement *element = GST_ELEMENT_PARENT(pad);
+	gst_element_set_locked_state(element, TRUE);
+	gst_element_set_state(element, GST_STATE_NULL);
+	gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(element)), element);
+}
+
 #endif
 
 #ifdef USE_GSTREAMER
@@ -582,6 +592,10 @@ purple_media_manager_get_element(PurpleM
 		ret = purple_media_element_info_call_create(info,
 				media, session_id, participant);
 		if (element_type & PURPLE_MEDIA_ELEMENT_SRC) {
+			GstPad *pad = gst_element_get_static_pad(ret, "src");
+			g_signal_connect(pad, "unlinked",
+					G_CALLBACK(nonunique_src_unlinked_cb), NULL);
+			gst_object_unref(pad);
 			gst_object_ref(ret);
 			gst_bin_add(GST_BIN(purple_media_manager_get_pipeline(manager)),
 				ret);



More information about the Commits mailing list