stream: set elements to NULL before removing
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 23 Apr 2013 08:16:17 +0000 (10:16 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 23 Apr 2013 08:28:34 +0000 (10:28 +0200)
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

index dbcb26e..8f2cd91 100644 (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);