diff options
Diffstat (limited to 'src/plugins/avfoundation/camera/avfmediarecordercontrol.mm')
-rw-r--r-- | src/plugins/avfoundation/camera/avfmediarecordercontrol.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm b/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm index 412dab76c..1b6e23ee5 100644 --- a/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm +++ b/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm @@ -37,6 +37,7 @@ #include "avfcameraservice.h" #include "avfcameracontrol.h" #include "avfaudioinputselectorcontrol.h" +#include "avfcamerautility.h" #include <QtCore/qurl.h> #include <QtCore/qfileinfo.h> @@ -330,6 +331,9 @@ void AVFMediaRecorderControl::setupSessionForCapture() && m_cameraControl->captureMode().testFlag(QCamera::CaptureVideo) && m_session->state() != QCamera::UnloadedState) { + // Lock the video capture device to make sure the active format is not reset + const AVFConfigurationLock lock(m_session->videoCaptureDevice()); + // Add audio input // Allow recording even if something wrong happens with the audio input initialization AVCaptureDevice *audioDevice = m_audioInputControl->createCaptureDevice(); @@ -359,7 +363,10 @@ void AVFMediaRecorderControl::setupSessionForCapture() } } else if (m_connected && (!m_cameraControl->captureMode().testFlag(QCamera::CaptureVideo) - || m_session->state() != QCamera::ActiveState)) { + || m_session->state() == QCamera::UnloadedState)) { + + // Lock the video capture device to make sure the active format is not reset + const AVFConfigurationLock lock(m_session->videoCaptureDevice()); [captureSession removeOutput:m_movieOutput]; |