wrappercamerabinsrc: handle when source creation fail

Remember to set the source to NULL state as adding it to the pipeline
will set it to the READY state.
This commit is contained in:
Thiago Santos 2015-05-01 19:39:58 -03:00
parent fc4f95bb7c
commit f9f6bbf4f5

View file

@ -487,18 +487,18 @@ check_and_replace_src (GstWrapperCameraBinSrc * self)
self->app_vid_src, "autovideosrc", DEFAULT_VIDEOSRC, self->app_vid_src, "autovideosrc", DEFAULT_VIDEOSRC,
"camerasrc-real-src"))) { "camerasrc-real-src"))) {
self->src_vid_src = NULL; self->src_vid_src = NULL;
return FALSE; goto fail;
} }
if (!gst_bin_add (cbin, self->src_vid_src)) { if (!gst_bin_add (cbin, self->src_vid_src)) {
return FALSE; goto fail;
} }
/* check if we already have the next element to link to */ /* check if we already have the next element to link to */
if (self->src_crop) { if (self->src_crop) {
if (!gst_element_link_pads (self->src_vid_src, "src", self->src_crop, if (!gst_element_link_pads (self->src_vid_src, "src", self->src_crop,
"sink")) { "sink")) {
return FALSE; goto fail;
} }
} }
@ -511,6 +511,11 @@ check_and_replace_src (GstWrapperCameraBinSrc * self)
} }
return TRUE; return TRUE;
fail:
if (self->src_vid_src)
gst_element_set_state (self->src_vid_src, GST_STATE_NULL);
return FALSE;
} }
/** /**