From 0ddd98bfa6420e87d33078a6ae22b73752e625d5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 23 Apr 2013 10:16:17 +0200 Subject: [PATCH] stream: set elements to NULL before removing When removing a stream, set the elements to NULL first. This avoids element-is-not-in-NULL-state errors when we dispose the elements. --- gst/rtsp-server/rtsp-stream.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index dbcb26e..8f2cd91 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -1168,8 +1168,7 @@ link_failed: * @bin: a #GstBin * @rtpbin: a rtpbin #GstElement * - * Remove the elements of @stream from @bin. @bin must be set - * to the NULL state before calling this. + * Remove the elements of @stream from @bin. * * Return: %TRUE on success. */ @@ -1202,6 +1201,12 @@ gst_rtsp_stream_leave_bin (GstRTSPStream * stream, GstBin * bin, priv->send_rtp_sink = NULL; for (i = 0; i < 2; i++) { + gst_element_set_state (priv->udpsink[i], GST_STATE_NULL); + gst_element_set_state (priv->appsink[i], GST_STATE_NULL); + gst_element_set_state (priv->appqueue[i], GST_STATE_NULL); + gst_element_set_state (priv->tee[i], GST_STATE_NULL); + gst_element_set_state (priv->funnel[i], GST_STATE_NULL); + gst_element_set_state (priv->appsrc[i], GST_STATE_NULL); /* and set udpsrc to NULL now before removing */ gst_element_set_locked_state (priv->udpsrc[i], FALSE); gst_element_set_state (priv->udpsrc[i], GST_STATE_NULL); -- 2.7.4