Gst capture: don't wait for pipeline to stop
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
Fri, 29 Jun 2012 02:18:54 +0000 (12:18 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 29 Jun 2012 05:28:19 +0000 (07:28 +0200)
State changes to lower state are synchronous in gstreamer

Change-Id: Ib87eabfeee9ec100f24efbaa989ec909ac7f9a1b
Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com>
Reviewed-by: Ling Hu <ling.hu@nokia.com>
src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h

index e2dc63b..ec83512 100644 (file)
@@ -773,17 +773,6 @@ QGstreamerCaptureSession::State QGstreamerCaptureSession::state() const
     return m_state;
 }
 
-void QGstreamerCaptureSession::waitForStopped()
-{
-    GstState state = GST_STATE_PLAYING;
-    gst_element_get_state(m_pipeline, &state, 0, 0);
-
-    while (state != GST_STATE_NULL) {
-        qApp->processEvents();
-        gst_element_get_state(m_pipeline, &state, 0, 0);
-    }
-}
-
 void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState)
 {
     if (newState == m_pendingState && !m_waitingForEos)
@@ -829,9 +818,6 @@ void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState
 
         gst_element_set_state(m_pipeline, GST_STATE_NULL);
 
-        //It would be better to do this async. but
-        //gstreamer doesn't notify about pipeline went to NULL state
-        waitForStopped();
         if (!rebuildGraph(newMode)) {
             m_pendingState = StoppedState;
             m_state = StoppedState;
index cb03b17..e8fe27c 100644 (file)
@@ -163,7 +163,6 @@ private:
     GstElement *buildVideoPreview();
     GstElement *buildImageCapture();
 
-    void waitForStopped();
     bool rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode);
 
     GstPad *getAudioProbePad();