From 6395b4590886cf8d02d7198f8c4968c19a137848 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Tue, 25 Jan 2011 18:10:18 -0300 Subject: [PATCH] camerabin2: Handle videosink states more carefully When going to ready, camerabin2 could create an empty file if the videosink was put to ready. This patch only puts videosink to ready on the PAUSED_TO_READY state change if it is on PAUSED or PLAYING. --- gst/camerabin2/gstcamerabin2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index 8b82c7fbb8..22d37e9937 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -630,8 +630,10 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans) switch (trans) { case GST_STATE_CHANGE_PAUSED_TO_READY: + if (GST_STATE (camera->videosink) >= GST_STATE_PAUSED) + gst_element_set_state (camera->videosink, GST_STATE_READY); + gst_tag_setter_reset_tags (GST_TAG_SETTER (camera)); - gst_element_set_state (camera->videosink, GST_STATE_READY); break; case GST_STATE_CHANGE_READY_TO_NULL: gst_element_set_state (camera->videosink, GST_STATE_NULL);