Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Commit

Permalink
Using batching for configuring input devices (camera switch is faster)
Browse files Browse the repository at this point in the history
  • Loading branch information
malomo committed Jul 17, 2016
1 parent 7158c87 commit 7bfa6d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CameraEngine/CameraEngineDeviceInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CameraEngineDeviceInput {
private var micDeviceInput: AVCaptureDeviceInput?

func configureInputCamera(session: AVCaptureSession, device: AVCaptureDevice) throws {
session.beginConfiguration()
let possibleCameraInput: AnyObject? = try AVCaptureDeviceInput(device: device)
if let cameraInput = possibleCameraInput as? AVCaptureDeviceInput {
if let currentDeviceInput = self.cameraDeviceInput {
Expand All @@ -33,6 +34,7 @@ class CameraEngineDeviceInput {
throw CameraEngineDeviceInputErrorType.UnableToAddCamera
}
}
session.commitConfiguration()
}

func configureInputMic(session: AVCaptureSession, device: AVCaptureDevice) throws {
Expand Down

0 comments on commit 7bfa6d9

Please sign in to comment.