Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
|
tkchin_webrtc
2015/12/04 22:19:42
nit: add blank line
Chuck
2015/12/05 00:21:23
Done.
| |
| 11 #error "This file requires ARC support." | |
| 12 #endif | |
| 13 | |
| 14 #import "RTCCameraPreviewView.h" | |
| 15 | |
| 16 #import <AVFoundation/AVFoundation.h> | |
| 17 | |
| 18 #import "RTCAVFoundationVideoSource+Internal.h" | |
| 19 | |
| 20 @implementation RTCCameraPreviewView | |
| 21 | |
| 22 @synthesize videoSource = _videoSource; | |
| 23 | |
| 24 + (Class)layerClass { | |
| 25 return [AVCaptureVideoPreviewLayer class]; | |
| 26 } | |
| 27 | |
| 28 | |
|
tkchin_webrtc
2015/12/04 22:19:41
nit: remove blank line
Chuck
2015/12/05 00:21:23
Done.
| |
| 29 - (void)setVideoSource:(RTCAVFoundationVideoSource *)videoSource { | |
| 30 if (_videoSource == videoSource) { | |
|
tkchin_webrtc
2015/12/04 22:19:41
Suggest not making this class depend on that parti
Chuck
2015/12/05 00:21:23
Done.
| |
| 31 return; | |
| 32 } | |
| 33 _videoSource = videoSource; | |
| 34 AVCaptureSession *captureSession = videoSource.captureSession; | |
| 35 AVCaptureVideoPreviewLayer *previewLayer = [self previewLayer]; | |
| 36 if (!videoSource) { | |
| 37 previewLayer.session = nil; | |
| 38 return; | |
| 39 } | |
| 40 dispatch_async(videoSource.captureSessionQueue, ^{ | |
| 41 previewLayer.session = captureSession; | |
| 42 }); | |
| 43 } | |
| 44 | |
| 45 #pragma mark - Private | |
| 46 | |
| 47 - (AVCaptureVideoPreviewLayer *)previewLayer { | |
| 48 return (AVCaptureVideoPreviewLayer *)self.layer; | |
| 49 } | |
| 50 | |
| 51 @end | |
| OLD | NEW |