From e0b9217d27509ded76daf6b18e1ed4c0fab280c7 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti de Araujo Date: Thu, 6 Aug 2015 18:29:28 -0300 Subject: 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 Reviewed-by: Yoann Lopes --- src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp index 3238e5c2..77d8987f 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -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 { -- cgit v1.2.3