gst_object_unref(GST_OBJECT(bus));
/* set pipeline state to PAUSED */
- MEDIADEMUXER_SET_STATE(gst_handle->pipeline, GST_STATE_PAUSED, ERROR);
+ MEDIADEMUXER_SET_STATE(gst_handle->pipeline, GST_STATE_PAUSED, ERROR_STATE_CHANGE);
if (gst_element_get_state(gst_handle->pipeline, &element_state, &element_pending_state, 1 * GST_SECOND)
== GST_STATE_CHANGE_FAILURE) {
gst_element_state_get_name(element_state),
gst_element_state_get_name(element_pending_state));
ret = MD_ERROR;
- goto ERROR;
+ goto ERROR_STATE_CHANGE;
}
- if (gst_handle->is_prepared != true) {
+ if (!gst_handle->is_prepared) {
MD_E("Error occure");
ret = MD_ERROR;
- goto ERROR;
+ goto ERROR_STATE_CHANGE;
}
MEDIADEMUXER_FLEAVE();
return ret;
+
ERROR:
+ if (gst_handle->filesrc)
+ gst_object_unref(gst_handle->filesrc);
+
+ if (gst_handle->typefind)
+ gst_object_unref(gst_handle->typefind);
+
+ if (gst_handle->fakesink)
+ gst_object_unref(gst_handle->fakesink);
+
+ERROR_STATE_CHANGE:
+ if (gst_handle->pipeline) {
+ gst_object_unref(gst_handle->pipeline);
+ gst_handle->pipeline = NULL;
+ }
+
+ gst_handle->filesrc = NULL;
+ gst_handle->typefind = NULL;
+ gst_handle->fakesink = NULL;
+
MEDIADEMUXER_FLEAVE();
return ret;
}