[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [gst-cvs] gst-plugins-bad: camerabin: Do not wrongly fail when
From:       thiagoss () kemper ! freedesktop ! org (Thiago Sousa Santos)
Date:       2010-09-29 21:45:02
Message-ID: 20100929214504.89AE210057 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: master
Commit: 5cb8164938cc4b902ee697a5754e203464fed9e1
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=5cb8164938cc4b902ee697a5754e203464fed9e1


Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Wed Sep 29 17:34:00 2010 -0300

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

---

 gst/camerabin/gstcamerabin.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index 5f2ef6d..000b69d 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);


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
gstreamer-cvs mailing list
gstreamer-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic