summaryrefslogtreecommitdiff
path: root/gst/camerabin2
diff options
context:
space:
mode:
authorThiago Santos <ts.santos@sisa.samsung.com>2014-02-03 23:10:03 -0300
committerThiago Santos <ts.santos@sisa.samsung.com>2014-02-04 14:17:26 -0300
commitcfda1aafa34563f98df738ebbdb409ab743b249b (patch)
tree81474ece37c92154ecf13a57d8e8d9ff02b7f9c2 /gst/camerabin2
parent3cdeea0cac5b9cdb06c26c2234ccda9ec5bdc6f1 (diff)
downloadgstreamer-plugins-bad-cfda1aafa34563f98df738ebbdb409ab743b249b.tar.gz
wrappercamerabinsrc: stop source to do internal reconfiguration safely
In order to be able to change the caps on multiple capsfilters the source element needs to be stopped, otherwise it will get a few reconfigure events and might try to renegotiate while the bin is still transitioning its caps, leading to a not-negotiated failure and the image capture won't happen because the source will be unusable. The solution is to keep the source in paused while the caps are being changed in the bin, and then bring the element back to playing once it is done. Unfortunately this increases the image capture latency, but it should always work. A possible improvement to reduce the latency is to add another signal to be called before 'start-capture': 'prepare-capture'. At this step the camera source should set all caps it needs and get the source ready for doing the capture as soon as 'start-capture' is called. This can be done on a future commit
Diffstat (limited to 'gst/camerabin2')
-rw-r--r--gst/camerabin2/gstwrappercamerabinsrc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c
index 2e3dda64f..c2111a0b7 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.c
+++ b/gst/camerabin2/gstwrappercamerabinsrc.c
@@ -828,6 +828,7 @@ start_image_capture (GstWrapperCameraBinSrc * self)
GstCaps *caps;
GST_DEBUG_OBJECT (self, "Starting image capture");
+ gst_element_set_state (self->src_vid_src, GST_STATE_READY);
if (self->image_renegotiate) {
/* clean capsfilter caps so they don't interfere here */
@@ -852,6 +853,7 @@ start_image_capture (GstWrapperCameraBinSrc * self)
}
if (photography) {
+ gst_element_set_state (self->src_vid_src, GST_STATE_PLAYING);
GST_DEBUG_OBJECT (self, "prepare image capture caps %" GST_PTR_FORMAT,
self->image_capture_caps);
ret = gst_photography_prepare_for_capture (photography,
@@ -863,6 +865,7 @@ start_image_capture (GstWrapperCameraBinSrc * self)
self->image_capture_caps);
g_mutex_lock (&bcamsrc->capturing_mutex);
ret = TRUE;
+ gst_element_set_state (self->src_vid_src, GST_STATE_PLAYING);
}
return ret;