summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-07-07 11:52:18 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2014-07-10 18:34:21 -0400
commit5e4e572335bed642dfab36c4f325fde342a370e5 (patch)
treee5eb6a45a146fb8ca7944f57d5dfd2f9db9db409 /gst
parentc534ad8e81258ede6b43a62e98b43f689ec87c51 (diff)
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
Diffstat (limited to 'gst')
-rw-r--r--gst/camerabin2/gstwrappercamerabinsrc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c
index c2111a0b7..48ec28f23 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.c
+++ b/gst/camerabin2/gstwrappercamerabinsrc.c
@@ -826,10 +826,22 @@ start_image_capture (GstWrapperCameraBinSrc * self)
GST_TYPE_PHOTOGRAPHY);
gboolean ret = FALSE;
GstCaps *caps;
+ GstPad *pad, *peer;
GST_DEBUG_OBJECT (self, "Starting image capture");
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) {
/* clean capsfilter caps so they don't interfere here */
g_object_set (self->src_filter, "caps", NULL, NULL);