mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 20:59:44 +00:00
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
This commit is contained in:
parent
3cdeea0cac
commit
cfda1aafa3
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue