camerabin: Preserve unused imagebin or videobin on NULL
authorLasse Laukkanen <lasse.laukkanen@digia.com>
Thu, 14 Apr 2011 01:33:37 +0000 (22:33 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 14 Apr 2011 01:34:35 +0000 (22:34 -0300)
If video or image mode is never selected then respective bin is in NULL state.
Preserve this state when resetting camerabin from PAUSED to READY.

gst/camerabin/gstcamerabin.c

index 7070903..99b1b54 100644 (file)
@@ -3851,8 +3851,12 @@ gst_camerabin_change_state (GstElement * element, GstStateChange transition)
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       /* all processing should stop and those elements could have their state
        * locked, so set them explicitly here */
-      gst_element_set_state (camera->imgbin, GST_STATE_READY);
-      gst_element_set_state (camera->vidbin, GST_STATE_READY);
+      if (GST_STATE (camera->imgbin) != GST_STATE_NULL) {
+        gst_element_set_state (camera->imgbin, GST_STATE_READY);
+      }
+      if (GST_STATE (camera->vidbin) != GST_STATE_NULL) {
+        gst_element_set_state (camera->vidbin, GST_STATE_READY);
+      }
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_element_set_locked_state (camera->imgbin, FALSE);