AVFoundation: fix microphone permission when using the camera.

The microphone permission was always requested when using the camera,
even when not actually using the microphone, which can only happen when
recording a video. The permission request is triggered by adding an
audio AVCaptureDeviceInput to the AVCaptureSession, which was done when
setting the camera to LoadedState. This is now done when setting the
camera mode to CaptureVideo.

Task-number: QTBUG-45659
Change-Id: I3692797128cfb70ba5ccbc7a36b6955471039e80
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
This commit is contained in:
Yoann Lopes
2015-04-21 18:07:19 +02:00
committed by Jani Heikkinen
parent 6fe3061c1f
commit bcaec9624c
4 changed files with 63 additions and 45 deletions

View File

@@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE
class AVFCameraSession;
class AVFCameraControl;
class AVFAudioInputSelectorControl;
class AVFCameraService;
class AVFMediaRecorderControl : public QMediaRecorderControl
@@ -78,11 +79,12 @@ public Q_SLOTS:
void handleRecordingFailed(const QString &message);
private Q_SLOTS:
void reconnectMovieOutput();
void setupSessionForCapture();
void updateStatus();
private:
AVFCameraControl *m_cameraControl;
AVFAudioInputSelectorControl *m_audioInputControl;
AVFCameraSession *m_session;
bool m_connected;
@@ -96,6 +98,7 @@ private:
bool m_muted;
qreal m_volume;
AVCaptureDeviceInput *m_audioInput;
AVCaptureMovieFileOutput *m_movieOutput;
AVFMediaRecorderDelegate *m_recorderDelagate;
AVFStorageLocation m_storageLocation;