Android: fix crash when stopping the camera while a recording is active

When unloading the camera, any active recording is automatically
stopped, which in turn triggers the viewfinder to be restarted...
We don't try anymore to restart the viewfinder after stopping recording
unless the camera is still active.

Change-Id: I77e4e3fc8d7116ac660d8bb23f6c400ebed4ffed
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
Yoann Lopes
2014-06-24 17:08:03 +02:00
parent 23d7bf7ac8
commit c8b88cd027

View File

@@ -269,7 +269,7 @@ void QAndroidCaptureSession::stop(bool error)
delete m_mediaRecorder;
m_mediaRecorder = 0;
if (m_cameraSession) {
if (m_cameraSession && m_cameraSession->status() == QCamera::ActiveStatus) {
// Viewport needs to be restarted after recording
restartViewfinder();
}
@@ -516,6 +516,7 @@ void QAndroidCaptureSession::updateStatus()
if (m_cameraSession->status() == QCamera::StoppingStatus
|| !m_cameraSession->captureMode().testFlag(QCamera::CaptureVideo)) {
setState(QMediaRecorder::StoppedState);
return;
}
if (m_state == QMediaRecorder::RecordingState) {