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 <christian.stromme@theqtcompany.com>
This commit is contained in:
Yoann Lopes
2016-03-11 15:40:57 +01:00
parent c8090b7952
commit b5a184ec2d

View File

@@ -34,6 +34,7 @@
#include "avfcameradebug.h" #include "avfcameradebug.h"
#include "avfimagecapturecontrol.h" #include "avfimagecapturecontrol.h"
#include "avfcameraservice.h" #include "avfcameraservice.h"
#include "avfcamerautility.h"
#include "avfcameracontrol.h" #include "avfcameracontrol.h"
#include <QtCore/qurl.h> #include <QtCore/qurl.h>
@@ -208,6 +209,8 @@ void AVFImageCaptureControl::updateCaptureConnection()
if (![captureSession.outputs containsObject:m_stillImageOutput]) { if (![captureSession.outputs containsObject:m_stillImageOutput]) {
if ([captureSession canAddOutput: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]; [captureSession addOutput:m_stillImageOutput];
m_videoConnection = [m_stillImageOutput connectionWithMediaType:AVMediaTypeVideo]; m_videoConnection = [m_stillImageOutput connectionWithMediaType:AVMediaTypeVideo];
updateReadyStatus(); updateReadyStatus();