Skip to content

Commit

Permalink
Fix compilation on iOS 10 sdk for video capture device.
Browse files Browse the repository at this point in the history
Bug: 768876
Change-Id: I2910f949b8ce8d8fd847dc8544ea7c8b63091714
Reviewed-on: https://chromium-review.googlesource.com/722919
Reviewed-by: Jean-François Geyelin <jif@chromium.org>
Commit-Queue: Eric Noyau <noyau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509391}
  • Loading branch information
e-noyau authored and Commit Bot committed Oct 17, 2017
1 parent 37d8de9 commit ea1c283
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ios/chrome/browser/ui/qr_scanner/camera_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,23 @@ - (void)loadCaptureSession:(AVCaptureVideoPreviewLayer*)previewLayer {
DCHECK([self getAuthorizationStatus] == AVAuthorizationStatusAuthorized);
dispatch_async(_sessionQueue, ^{
// Get the back camera.
NSArray* videoCaptureDevices =
[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
NSArray* videoCaptureDevices = nil;
if (@available(iOS 10, *)) {
AVCaptureDeviceDiscoverySession* discoverySession =
[AVCaptureDeviceDiscoverySession
discoverySessionWithDeviceTypes:@[
AVCaptureDeviceTypeBuiltInWideAngleCamera
]
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionBack];
videoCaptureDevices = [discoverySession devices];
}
#if !defined(__IPHONE_10_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
else {
videoCaptureDevices =
[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
}
#endif
if ([videoCaptureDevices count] == 0) {
[self setCameraState:qr_scanner::CAMERA_UNAVAILABLE];
return;
Expand Down

0 comments on commit ea1c283

Please sign in to comment.