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.
This commit is contained in:
Wim Taymans 2013-04-23 10:16:17 +02:00
parent a09210b648
commit 0ddd98bfa6

View file

@ -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);