change state of pipeline to NULL before freeing.

This commit is contained in:
Nils Hasler 2011-05-06 19:06:33 +00:00
parent 43f12fa96b
commit 39b79b1261

View File

@ -347,12 +347,12 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
if(!uridecodebin) { if(!uridecodebin) {
uridecodebin = gst_element_factory_make ("uridecodebin", NULL); uridecodebin = gst_element_factory_make ("uridecodebin", NULL);
g_object_set(G_OBJECT(uridecodebin),"uri",uri, NULL); g_object_set(G_OBJECT(uridecodebin),"uri",uri, NULL);
}
if(!uridecodebin) { if(!uridecodebin) {
CV_WARN("GStreamer: Failed to create uridecodebin\n"); CV_WARN("GStreamer: Failed to create uridecodebin\n");
close(); close();
return false; return false;
} }
}
if(manualpipeline) { if(manualpipeline) {
GstIterator *it = gst_bin_iterate_sinks(GST_BIN(uridecodebin)); GstIterator *it = gst_bin_iterate_sinks(GST_BIN(uridecodebin));
@ -401,6 +401,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
if(gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING) == if(gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING) ==
GST_STATE_CHANGE_FAILURE) { GST_STATE_CHANGE_FAILURE) {
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
CV_WARN("GStreamer: unable to set pipeline to playing\n"); CV_WARN("GStreamer: unable to set pipeline to playing\n");
gst_object_unref(pipeline); gst_object_unref(pipeline);
return false; return false;