summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-09-29 17:34:00 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-09-29 18:42:27 -0300
commit5cb8164938cc4b902ee697a5754e203464fed9e1 (patch)
tree8aa687b731c0b433eb4e520729e77017473b36f3
parentde97a994ba87b0b3e361532878e4366842d85f3c (diff)
camerabin: Do not wrongly fail when starting a capture
If the elements are in NULL/READY and changing state to PAUSED/PLAYING while a capture is started camerabin might not set the active_bin properly causing the capture start to fail. This patch fixes it by checking the current and pending state of the branches instead of only the current one
-rw-r--r--gst/camerabin/gstcamerabin.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index 5f2ef6d70..000b69d35 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -963,15 +963,17 @@ static void
gst_camerabin_change_mode (GstCameraBin * camera, gint mode)
{
if (camera->mode != mode || !camera->active_bin) {
- GstState state;
+ GstState state, pending_state;
GST_DEBUG_OBJECT (camera, "setting mode: %d (old_mode=%d)",
mode, camera->mode);
/* Interrupt ongoing capture */
gst_camerabin_do_stop (camera);
camera->mode = mode;
- gst_element_get_state (GST_ELEMENT (camera), &state, NULL, 0);
- if (state == GST_STATE_PAUSED || state == GST_STATE_PLAYING) {
+ gst_element_get_state (GST_ELEMENT (camera), &state, &pending_state, 0);
+ if (state == GST_STATE_PAUSED || state == GST_STATE_PLAYING ||
+ pending_state == GST_STATE_PAUSED
+ || pending_state == GST_STATE_PLAYING) {
if (camera->active_bin) {
GST_DEBUG_OBJECT (camera, "stopping active bin");
gst_element_set_state (camera->active_bin, GST_STATE_READY);