From: Ognyan Tonchev Date: Mon, 22 Apr 2013 14:40:48 +0000 (+0200) Subject: media: disconnect from signal handlers in unprepare() X-Git-Tag: 1.19.3~495^2~1151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a26b06cc69b2dfed17b64eab236e0f1aafaea084;p=platform%2Fupstream%2Fgstreamer.git media: disconnect from signal handlers in unprepare() We connected to the pad-added and no-more-pads signals in prepare() so we need to disconnect from them in unprepare(). See https://bugzilla.gnome.org/show_bug.cgi?id=698376 --- diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index e81aa126d7..5eaf979075 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -1406,6 +1406,14 @@ no_more_pads_cb (GstElement * element, GstRTSPMedia * media) } } +typedef struct _DynPaySignalHandlers DynPaySignalHandlers; + +struct _DynPaySignalHandlers +{ + gulong pad_added_handler; + gulong no_more_pads_handler; +}; + /** * gst_rtsp_media_prepare: * @media: a #GstRTSPMedia @@ -1490,11 +1498,16 @@ gst_rtsp_media_prepare (GstRTSPMedia * media) for (walk = priv->dynamic; walk; walk = g_list_next (walk)) { GstElement *elem = walk->data; + DynPaySignalHandlers *handlers = g_slice_new (DynPaySignalHandlers); GST_INFO ("adding callbacks for dynamic element %p", elem); - g_signal_connect (elem, "pad-added", (GCallback) pad_added_cb, media); - g_signal_connect (elem, "no-more-pads", (GCallback) no_more_pads_cb, media); + handlers->pad_added_handler = g_signal_connect (elem, "pad-added", + (GCallback) pad_added_cb, media); + handlers->no_more_pads_handler = g_signal_connect (elem, "no-more-pads", + (GCallback) no_more_pads_cb, media); + + g_object_set_data (G_OBJECT (elem), "gst-rtsp-dynpay-handlers", handlers); /* we add a fakesink here in order to make the state change async. We remove * the fakesink again in the no-more-pads callback. */ @@ -1590,6 +1603,7 @@ finish_unprepare (GstRTSPMedia * media) { GstRTSPMediaPrivate *priv = media->priv; gint i; + GList *walk; GST_DEBUG ("shutting down"); @@ -1605,6 +1619,21 @@ finish_unprepare (GstRTSPMedia * media) gst_rtsp_stream_leave_bin (stream, GST_BIN (priv->pipeline), priv->rtpbin); } + /* remove the pad signal handlers */ + for (walk = priv->dynamic; walk; walk = g_list_next (walk)) { + GstElement *elem = walk->data; + DynPaySignalHandlers *handlers; + + handlers = g_object_steal_data (G_OBJECT (elem), "gst-rtsp-dypay-handlers"); + g_assert (handlers != NULL); + + g_signal_handler_disconnect (G_OBJECT (elem), handlers->pad_added_handler); + g_signal_handler_disconnect (G_OBJECT (elem), + handlers->no_more_pads_handler); + + g_slice_free (DynPaySignalHandlers, handlers); + } + gst_bin_remove (GST_BIN (priv->pipeline), priv->rtpbin); priv->rtpbin = NULL;