diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-06-10 10:05:56 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-06-10 16:16:29 +0200 |
commit | 8dc7fae455266f8e93101fb83edcd9bf41e97544 (patch) | |
tree | 67d4364cf8c6514534dfb5918fe03df4727d5adf /gst/camerabin2 | |
parent | aad0992ae648b38121dd74cc4dd363f83e72ab10 (diff) | |
download | gstreamer-plugins-bad-8dc7fae455266f8e93101fb83edcd9bf41e97544.tar.gz |
wrappercamerabinsrc: Don't unset the video-source property on pipeline start
check_and_replace_src() was setting self->app_vid_src to NULL, which
means that an app setting the video-source property, and then starting,
stopping and re-starting the pipeline (ie to make changes to the
video-source-filter property) would after the restart no longer have
a video-source.
This patch fixes this by making gst_camerabin_setup_default_element return a
ref to the passed in user_element, rather then returning the user_element as
is, so that that ref can be passed on to the bin, and the app_vid_src ref
stays valid.
https://bugzilla.gnome.org/show_bug.cgi?id=701915
Diffstat (limited to 'gst/camerabin2')
-rw-r--r-- | gst/camerabin2/camerabingeneral.c | 17 | ||||
-rw-r--r-- | gst/camerabin2/gstwrappercamerabinsrc.c | 2 |
2 files changed, 8 insertions, 11 deletions
diff --git a/gst/camerabin2/camerabingeneral.c b/gst/camerabin2/camerabingeneral.c index 43d681d4c..45a0df46a 100644 --- a/gst/camerabin2/camerabingeneral.c +++ b/gst/camerabin2/camerabingeneral.c @@ -172,11 +172,11 @@ gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name, return new_elem; } -/* try to change the state of an element. This function returns the element when - * the state change could be performed. When this function returns NULL an error - * occured and the element is unreffed if @unref is TRUE. */ +/* try to change the state of an element. This function returns the element + * when the state change could be performed. When this function returns NULL + * an error occured and the element is unreffed. */ static GstElement * -try_element (GstElement * bin, GstElement * element, gboolean unref) +try_element (GstElement * bin, GstElement * element) { GstStateChangeReturn ret; @@ -185,8 +185,7 @@ try_element (GstElement * bin, GstElement * element, gboolean unref) if (ret == GST_STATE_CHANGE_FAILURE) { GST_DEBUG_OBJECT (bin, "failed state change.."); gst_element_set_state (element, GST_STATE_NULL); - if (unref) - gst_object_unref (element); + gst_object_unref (element); element = NULL; } } @@ -202,18 +201,18 @@ gst_camerabin_setup_default_element (GstBin * bin, GstElement * user_elem, if (user_elem) { GST_DEBUG_OBJECT (bin, "trying configured element"); - elem = try_element (GST_ELEMENT_CAST (bin), user_elem, FALSE); + elem = try_element (GST_ELEMENT_CAST (bin), gst_object_ref (user_elem)); } else { /* only try fallback if no specific sink was chosen */ GST_DEBUG_OBJECT (bin, "trying %s", auto_elem_name); elem = gst_element_factory_make (auto_elem_name, instance_name); - elem = try_element (GST_ELEMENT_CAST (bin), elem, TRUE); + elem = try_element (GST_ELEMENT_CAST (bin), elem); if (elem == NULL) { /* if default sink from config.h is different then try it too */ if (strcmp (default_elem_name, auto_elem_name)) { GST_DEBUG_OBJECT (bin, "trying %s", default_elem_name); elem = gst_element_factory_make (default_elem_name, instance_name); - elem = try_element (GST_ELEMENT_CAST (bin), elem, TRUE); + elem = try_element (GST_ELEMENT_CAST (bin), elem); } } } diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 3e9dc5ac0..3f94428e2 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -489,8 +489,6 @@ check_and_replace_src (GstWrapperCameraBinSrc * self) } } } - /* we lost the reference */ - self->app_vid_src = NULL; /* we listen for changes to max-zoom in the video src so that * we can proxy them to the basecamerasrc property */ |