AVFImageCaptureControl - invalid connection
AVCaptureConnection from AVCaptureStillImageOutput becomes invalid as we remove/add AVCaptureDevice. Change-Id: I698ffcc0b91b76cd5d7c25e4b244eaa0aa459159 Task-number: QTBUG-42035 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
@@ -194,28 +194,19 @@ void AVFImageCaptureControl::cancelCapture()
|
|||||||
|
|
||||||
void AVFImageCaptureControl::updateCaptureConnection()
|
void AVFImageCaptureControl::updateCaptureConnection()
|
||||||
{
|
{
|
||||||
if (!m_videoConnection &&
|
if (m_cameraControl->captureMode().testFlag(QCamera::CaptureStillImage)) {
|
||||||
m_cameraControl->captureMode().testFlag(QCamera::CaptureStillImage)) {
|
|
||||||
qDebugCamera() << Q_FUNC_INFO;
|
qDebugCamera() << Q_FUNC_INFO;
|
||||||
AVCaptureSession *captureSession = m_session->captureSession();
|
AVCaptureSession *captureSession = m_session->captureSession();
|
||||||
|
|
||||||
if ([captureSession canAddOutput:m_stillImageOutput]) {
|
if (![captureSession.outputs containsObject:m_stillImageOutput]) {
|
||||||
[captureSession addOutput:m_stillImageOutput];
|
if ([captureSession canAddOutput:m_stillImageOutput]) {
|
||||||
|
[captureSession addOutput:m_stillImageOutput];
|
||||||
for (AVCaptureConnection *connection in m_stillImageOutput.connections) {
|
m_videoConnection = [m_stillImageOutput connectionWithMediaType:AVMediaTypeVideo];
|
||||||
for (AVCaptureInputPort *port in [connection inputPorts]) {
|
updateReadyStatus();
|
||||||
if ([[port mediaType] isEqual:AVMediaTypeVideo] ) {
|
|
||||||
m_videoConnection = connection;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_videoConnection)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_videoConnection = [m_stillImageOutput connectionWithMediaType:AVMediaTypeVideo];
|
||||||
}
|
}
|
||||||
|
|
||||||
updateReadyStatus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user