Mercurial > pidgin.yaz
diff libpurple/media.c @ 26166:218f052b9bf5
Fix removing output windows when the session is rejected.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 05 Feb 2009 00:15:13 +0000 |
parents | 1aed9a92b657 |
children | 8a402c91fe6f 23038e1a1754 |
line wrap: on
line diff
--- a/libpurple/media.c Mon Feb 02 09:58:14 2009 +0000 +++ b/libpurple/media.c Thu Feb 05 00:15:13 2009 +0000 @@ -2390,12 +2390,30 @@ if (session_id != NULL && participant == NULL) { PurpleMediaSession *session; + GstPad *pad, *peer; + session = purple_media_get_session(media, session_id); if (session == NULL) return FALSE; sink = session->sink; + + if (!GST_IS_ELEMENT(sink)) + return FALSE; + + pad = gst_element_get_static_pad(sink, "ghostsink"); + peer = gst_pad_get_peer(pad); + gst_object_unref(pad); + + gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer); + gst_object_unref(peer); + + gst_element_set_state(sink, GST_STATE_NULL); + + gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(sink)), sink); + session->sink = NULL; + return TRUE; } else if (session_id != NULL && participant != NULL) { PurpleMediaStream *stream; stream = purple_media_get_stream(media, @@ -2413,6 +2431,13 @@ /* Remove sink */ parent = GST_ELEMENT(gst_element_get_parent(sink)); + + if (parent == NULL) { + /* It's not added and therefore not linked */ + gst_object_unref(sink); + return FALSE; + } + pad = gst_element_get_static_pad(sink, "ghostsink"); if (pad == NULL) {