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 | |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 12 #error "This file requires ARC support." | |
| 13 #endif | |
| 14 | |
| 15 #import "webrtc/base/objc/RTCCameraPreviewView.h" | |
| 16 | |
| 17 #import <AVFoundation/AVFoundation.h> | |
| 18 | |
| 19 #import "webrtc/base/objc/RTCDispatcher.h" | |
| 20 | |
| 21 @implementation RTCCameraPreviewView | |
| 22 | |
| 23 @synthesize captureSession = _captureSession; | |
| 24 | |
| 25 + (Class)layerClass { | |
| 26 return [AVCaptureVideoPreviewLayer class]; | |
| 27 } | |
| 28 | |
| 29 - (void)setCaptureSession:(AVCaptureSession *)captureSession { | |
| 30 if (_captureSession == captureSession) { | |
| 31 return; | |
| 32 } | |
| 33 _captureSession = captureSession; | |
|
tkchin_webrtc
2015/12/07 18:27:07
do we need the ivar?
Chuck
2015/12/07 19:34:31
I don't think we strictly need it, but we can't ex
| |
| 34 AVCaptureVideoPreviewLayer *previewLayer = [self previewLayer]; | |
| 35 [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession | |
| 36 block:^{ | |
| 37 previewLayer.session = captureSession; | |
| 38 }]; | |
| 39 } | |
| 40 | |
| 41 #pragma mark - Private | |
| 42 | |
| 43 - (AVCaptureVideoPreviewLayer *)previewLayer { | |
| 44 return (AVCaptureVideoPreviewLayer *)self.layer; | |
| 45 } | |
| 46 | |
| 47 @end | |
| OLD | NEW |