From 6e3d6bf8322efd609d3a3ed33c5101072176ed5a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 5 May 2017 09:32:39 +0200 Subject: Emit the StoppedState change after the file has finished writing Where possible, we should be emitting the stateChanged() signal to StoppedState when we know the file is no longer being written to. The finializing status can be used to indicate it is finishing and when it is actually finished then StoppedState should be used. Task-number: QTBUG-50588 Change-Id: Ie3ac1c5cd00a6a36978e72b5485622e3302054ce Reviewed-by: Christian Stromme --- src/plugins/avfoundation/camera/avfmediarecordercontrol.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins/avfoundation/camera/avfmediarecordercontrol.mm') diff --git a/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm b/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm index 79bf2e932..02261027d 100644 --- a/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm +++ b/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm @@ -306,14 +306,16 @@ void AVFMediaRecorderControl::setState(QMediaRecorder::State state) } break; case QMediaRecorder::StoppedState: { - m_state = QMediaRecorder::StoppedState; + m_lastStatus = QMediaRecorder::FinalizingStatus; + Q_EMIT statusChanged(m_lastStatus); [m_movieOutput stopRecording]; unapplySettings(); } } updateStatus(); - Q_EMIT stateChanged(m_state); + if (state != m_state) + Q_EMIT stateChanged(m_state); } void AVFMediaRecorderControl::setMuted(bool muted) @@ -341,6 +343,10 @@ void AVFMediaRecorderControl::handleRecordingStarted() void AVFMediaRecorderControl::handleRecordingFinished() { m_recordingFinished = true; + if (m_state != QMediaRecorder::StoppedState) { + m_state = QMediaRecorder::StoppedState; + Q_EMIT stateChanged(m_state); + } updateStatus(); } -- cgit v1.2.3