Avoid races when sending EOS

In order to avoid races when sending EOS, we need to make sure that the
pipeline is in playing state first.

Task-number: QTBUG-45707
Change-Id: I518e89badf38bea8ab8e2cead9a1ca09659af8b2
Reviewed-by: Timo Jyrinki <timo.jyrinki@canonical.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
Ricardo Salveti de Araujo
2015-08-06 18:29:28 -03:00
committed by Yoann Lopes
parent c9533b5aaf
commit e0b9217d27

View File

@@ -776,11 +776,11 @@ void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState
if (!m_waitingForEos) {
m_waitingForEos = true;
//qDebug() << "Waiting for EOS";
// Unless gstreamer is in GST_STATE_PLAYING our EOS message will not be received.
gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
//with live sources it's necessary to send EOS even to pipeline
//before going to STOPPED state
gst_element_send_event(m_pipeline, gst_event_new_eos());
// Unless gstreamer is in GST_STATE_PLAYING our EOS message will not be received.
gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
return;
} else {