Reconfigure capture session in a single transaction.

If we don't reconfigure capture session in a single transaction,
RTCCameraPreviewView goes transparent when switching cameras. This is
undesired behavior.

BUG=webrtc:7177

Review-Url: https://codereview.webrtc.org/2811643006
Cr-Commit-Position: refs/heads/master@{#17664}
This commit is contained in:
sakal 2017-04-12 01:27:44 -07:00 committed by Commit bot
parent 5e79b29313
commit 844d2b9670

View File

@ -378,6 +378,7 @@ static inline BOOL IsMediaSubTypeSupported(FourCharCode mediaSubType) {
RTCLogError(@"Failed to create front camera input: %@", error.localizedDescription);
return;
}
[_captureSession beginConfiguration];
for (AVCaptureDeviceInput *oldInput in [_captureSession.inputs copy]) {
[_captureSession removeInput:oldInput];
}
@ -385,8 +386,8 @@ static inline BOOL IsMediaSubTypeSupported(FourCharCode mediaSubType) {
[_captureSession addInput:input];
} else {
RTCLogError(@"Cannot add camera as an input to the session.");
return;
}
[_captureSession commitConfiguration];
}
- (void)updateOrientation {