Commit 5e4e5723 authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Nicolas Dufresne

camerabin2: Flush downstream after setting src to READY

v4l2src requires all buffers to come back in order to cleanly stop
streaming. Flushing the pipline should force all buffers to come
back.

https://bugzilla.gnome.org/show_bug.cgi?id=732741
parent c534ad8e
...@@ -826,10 +826,22 @@ start_image_capture (GstWrapperCameraBinSrc * self) ...@@ -826,10 +826,22 @@ start_image_capture (GstWrapperCameraBinSrc * self)
GST_TYPE_PHOTOGRAPHY); GST_TYPE_PHOTOGRAPHY);
gboolean ret = FALSE; gboolean ret = FALSE;
GstCaps *caps; GstCaps *caps;
GstPad *pad, *peer;
GST_DEBUG_OBJECT (self, "Starting image capture"); GST_DEBUG_OBJECT (self, "Starting image capture");
gst_element_set_state (self->src_vid_src, GST_STATE_READY); gst_element_set_state (self->src_vid_src, GST_STATE_READY);
/* FIXME - V4L2 source will not close the device until all buffers have came
* back. Flushing the pipeline, will ensure it's properly closed, and that
* setting it back to PLAYING will work. This is more a workaround then a
* solution to buffer reclaiming. */
pad = gst_element_get_static_pad (self->src_vid_src, "src");
peer = gst_pad_get_peer (pad);
gst_object_unref (pad);
gst_pad_send_event (peer, gst_event_new_flush_start ());
gst_pad_send_event (peer, gst_event_new_flush_stop (TRUE));
gst_object_unref (peer);
if (self->image_renegotiate) { if (self->image_renegotiate) {
/* clean capsfilter caps so they don't interfere here */ /* clean capsfilter caps so they don't interfere here */
g_object_set (self->src_filter, "caps", NULL, NULL); g_object_set (self->src_filter, "caps", NULL, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment