From b5a184ec2da2c17d2a6d03b416130bf300614664 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 11 Mar 2016 15:40:57 +0100 Subject: [PATCH] AVFoundation: fix switching to still image capture mode. It would reset the active format on the capture device. The patch prevents that. Change-Id: I97c192c064bf3c6ed4ba1f8d78768196927819a7 Reviewed-by: Christian Stromme --- src/plugins/avfoundation/camera/avfimagecapturecontrol.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm b/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm index edaaf8ce..3e6b6c77 100644 --- a/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm +++ b/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm @@ -34,6 +34,7 @@ #include "avfcameradebug.h" #include "avfimagecapturecontrol.h" #include "avfcameraservice.h" +#include "avfcamerautility.h" #include "avfcameracontrol.h" #include @@ -208,6 +209,8 @@ void AVFImageCaptureControl::updateCaptureConnection() if (![captureSession.outputs containsObject:m_stillImageOutput]) { if ([captureSession canAddOutput:m_stillImageOutput]) { + // Lock the video capture device to make sure the active format is not reset + const AVFConfigurationLock lock(m_session->videoCaptureDevice()); [captureSession addOutput:m_stillImageOutput]; m_videoConnection = [m_stillImageOutput connectionWithMediaType:AVMediaTypeVideo]; updateReadyStatus();