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.
This commit is contained in:
Thiago Santos 2011-01-25 18:10:18 -03:00
parent 3da135ce02
commit 6395b45908

View file

@ -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);