}
if (stream->src) {
- GST_MANIFEST_UNLOCK (demux);
- gst_element_set_locked_state (stream->src, TRUE);
- gst_element_set_state (stream->src, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (demux), stream->src);
+ GstElement *src = stream->src;
+
stream->src = NULL;
+
+ GST_MANIFEST_UNLOCK (demux);
+ gst_element_set_locked_state (src, TRUE);
+ gst_element_set_state (src, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN_CAST (demux), src);
GST_MANIFEST_LOCK (demux);
}
GST_MANIFEST_UNLOCK (demux);
if (src) {
- gst_element_set_locked_state (stream->src, TRUE);
+ gst_element_set_locked_state (src, TRUE);
gst_element_set_state (src, GST_STATE_READY);
}
new_protocol = gst_uri_get_protocol (uri);
if (!g_str_equal (old_protocol, new_protocol)) {
- gst_object_unref (stream->src_srcpad);
- gst_element_set_locked_state (stream->src, TRUE);
- gst_element_set_state (stream->src, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (demux), stream->src);
+ GstElement *src = stream->src;
+
stream->src = NULL;
+ gst_object_unref (stream->src_srcpad);
stream->src_srcpad = NULL;
+ GST_MANIFEST_UNLOCK (demux);
+ gst_element_set_locked_state (src, TRUE);
+ gst_element_set_state (src, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN_CAST (demux), src);
+ GST_MANIFEST_LOCK (demux);
GST_DEBUG_OBJECT (demux, "Can't re-use old source element");
} else {
GError *err = NULL;
GST_DEBUG_OBJECT (demux, "Re-using old source element");
if (!gst_uri_handler_set_uri (GST_URI_HANDLER (stream->uri_handler), uri,
&err)) {
+ GstElement *src = stream->src;
+
+ stream->src = NULL;
GST_DEBUG_OBJECT (demux, "Failed to re-use old source element: %s",
err->message);
g_clear_error (&err);
gst_object_unref (stream->src_srcpad);
- gst_element_set_locked_state (stream->src, TRUE);
- gst_element_set_state (stream->src, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (demux), stream->src);
- stream->src = NULL;
stream->src_srcpad = NULL;
+ GST_MANIFEST_UNLOCK (demux);
+ gst_element_set_locked_state (src, TRUE);
+ gst_element_set_state (src, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN_CAST (demux), src);
+ GST_MANIFEST_LOCK (demux);
}
}
g_free (old_uri);
gst_element_set_locked_state (stream->src, TRUE);
+ GST_MANIFEST_UNLOCK (demux);
if (gst_element_set_state (stream->src,
GST_STATE_READY) != GST_STATE_CHANGE_FAILURE) {
if (start != 0 || end != -1) {
GST_FORMAT_BYTES, (GstSeekFlags) GST_SEEK_FLAG_FLUSH,
GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, end))) {
+ GST_MANIFEST_LOCK (demux);
/* looks like the source can't handle seeks in READY */
g_clear_error (&stream->last_error);
stream->last_error = g_error_new (GST_CORE_ERROR,
GST_CORE_ERROR_NOT_IMPLEMENTED,
"Source element can't handle range requests");
stream->last_ret = GST_FLOW_ERROR;
+ } else {
+ GST_MANIFEST_LOCK (demux);
}
+ } else {
+ GST_MANIFEST_LOCK (demux);
}
if (G_LIKELY (stream->last_ret == GST_FLOW_OK)) {
}
}
} else {
+ GST_MANIFEST_UNLOCK (demux);
if (stream->last_ret == GST_FLOW_OK)
stream->last_ret = GST_FLOW_CUSTOM_ERROR;
ret = GST_FLOW_CUSTOM_ERROR;
gst_task_stop (stream->download_task);
if (stream->src) {
- gst_element_set_locked_state (stream->src, TRUE);
- gst_element_set_state (stream->src, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (demux), stream->src);
+ GstElement *src = stream->src;
+
stream->src = NULL;
+ GST_MANIFEST_UNLOCK (demux);
+ gst_element_set_locked_state (src, TRUE);
+ gst_element_set_state (src, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN_CAST (demux), src);
+ GST_MANIFEST_LOCK (demux);
}
gst_element_post_message (GST_ELEMENT_CAST (demux), msg);