summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-07-24 12:53:07 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-09-28 11:15:43 +0000
commitad9f763efea36663bf17321459d44e8dd5e5e653 (patch)
tree50938fd01925df149fb061cf2d111d31a0d2523e
parent4b8414b51dac70d949c0f516e1a7d8e723b97c29 (diff)
Gstreamer: Emit stateChanged(StoppedState) when recording is finishedv5.12.0-beta1
When stop is requested, the state becomes QMediaRecorder::StoppedState and stateChanged() is sent immediately, also the status is changed from QMediaRecorder::RecordingStatus to QMediaRecorder::FinalizingStatus. But since stopping is asynchronous QMediaRecorder::StoppedState is sent before recording has been fully finished. When EOS is received from gstreamer and recording has been fully stopped, the status will be changed from QMediaRecorder::FinalizingStatus to QMediaRecorder::LoadedStatus and only in this case. So fixed to send stateChanged(QMediaRecorder::StoppedState) right after LoadedStatus. Task-number: QTBUG-69402 Change-Id: Ic7429a4bfea6b1f443a105a0540737072ad42de2 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp2
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
index b268592c..c83e467a 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
@@ -107,8 +107,6 @@ QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::Cap
qWarning() << QMediaRecorder::Error(e) << ":" << str.toLatin1().constData();
});
m_mediaContainerControl = new QGstreamerMediaContainerControl(this);
-
- setState(StoppedState);
}
QGstreamerCaptureSession::~QGstreamerCaptureSession()
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
index 95820480..ba26d8df 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
@@ -115,6 +115,9 @@ void QGstreamerRecorderControl::updateStatus()
if (m_status != newStatus) {
m_status = newStatus;
emit statusChanged(m_status);
+ // If stop has been called and session state became stopped.
+ if (m_status == QMediaRecorder::LoadedStatus)
+ emit stateChanged(m_state);
}
}
@@ -204,7 +207,6 @@ void QGstreamerRecorderControl::stop()
m_session->setState(QGstreamerCaptureSession::PreviewState);
}
- emit stateChanged(m_state);
updateStatus();
}