basecamerasrc: Fail state change if preview pipeline fails creation

If the preview pipeline fails creation, for any reason, we should
fail basecamerasrc state change.

Also adds a missing g_return_if_fail check to preview pipeline
functions
This commit is contained in:
Thiago Santos 2011-09-20 13:00:49 -03:00
parent 7d5bd1992e
commit 43ec4f46b8
2 changed files with 7 additions and 1 deletions

View file

@ -445,7 +445,11 @@ gst_base_camera_src_change_state (GstElement * element,
gst_camerabin_create_preview_pipeline (GST_ELEMENT_CAST (self),
self->preview_filter);
g_assert (self->preview_pipeline != NULL);
if (self->preview_pipeline == NULL) {
/* failed to create preview pipeline, fail state change */
return GST_STATE_CHANGE_FAILURE;
}
self->preview_filter_changed = FALSE;
if (self->preview_caps) {
GST_DEBUG_OBJECT (self,

View file

@ -231,6 +231,8 @@ void
gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData *
preview)
{
g_return_if_fail (preview != NULL);
if (preview->processing_lock) {
g_mutex_free (preview->processing_lock);
preview->processing_lock = NULL;