diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-06-21 10:28:35 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-06-25 14:15:30 +0000 |
commit | 5c8f9a292c2b3352373c7c9833519e06fc4bff0a (patch) | |
tree | f48e0dc26586c3f27db83f23a5056168b6beaf14 | |
parent | e2fb22c15a53372f768aa362c37caa0d6f4b57c8 (diff) | |
download | qtmultimedia-5c8f9a292c2b3352373c7c9833519e06fc4bff0a.tar.gz |
AVFoundation: Fix crash when no video capture device
No need to configure anything if there is no video capture device.
Task-number: QTBUG-65740
Change-Id: I8de7dced14b00ab3eba560f395d7e1a4a5de1682
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
-rw-r--r-- | src/plugins/avfoundation/camera/avfimagecapturecontrol.mm | 3 | ||||
-rw-r--r-- | src/plugins/avfoundation/camera/avfmediarecordercontrol.mm | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm b/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm index bad1b362b..dbaf3ed41 100644 --- a/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm +++ b/src/plugins/avfoundation/camera/avfimagecapturecontrol.mm @@ -226,7 +226,8 @@ void AVFImageCaptureControl::cancelCapture() void AVFImageCaptureControl::updateCaptureConnection() { - if (m_cameraControl->captureMode().testFlag(QCamera::CaptureStillImage)) { + if (m_session->videoCaptureDevice() + && m_cameraControl->captureMode().testFlag(QCamera::CaptureStillImage)) { qDebugCamera() << Q_FUNC_INFO; AVCaptureSession *captureSession = m_session->captureSession(); diff --git a/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm b/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm index 02261027d..546eabf89 100644 --- a/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm +++ b/src/plugins/avfoundation/camera/avfmediarecordercontrol.mm @@ -364,6 +364,9 @@ void AVFMediaRecorderControl::handleRecordingFailed(const QString &message) void AVFMediaRecorderControl::setupSessionForCapture() { + if (!m_session->videoCaptureDevice()) + return; + //adding movie output causes high CPU usage even when while recording is not active, //connect it only while video capture mode is enabled. // Similarly, connect the Audio input only in that mode, since it's only necessary |