OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 self = [super initWithCoder:aCoder]; | 44 self = [super initWithCoder:aCoder]; |
45 if (self) { | 45 if (self) { |
46 [self configure]; | 46 [self configure]; |
47 } | 47 } |
48 return self; | 48 return self; |
49 } | 49 } |
50 | 50 |
51 #pragma mark - Private | 51 #pragma mark - Private |
52 | 52 |
53 + (BOOL)isMetalAvailable { | 53 + (BOOL)isMetalAvailable { |
54 #if defined(RTC_SUPPORTS_METAL) | 54 #if defined(__OBJC__) && COREVIDEO_SUPPORTS_METAL |
55 return YES; | 55 return YES; |
56 #else | 56 #elif |
57 return NO; | 57 return NO; |
58 #endif | 58 #endif |
59 } | 59 } |
60 | 60 |
61 - (void)configure { | 61 - (void)configure { |
62 if ([RTCMTLVideoView isMetalAvailable]) { | 62 if ([RTCMTLVideoView isMetalAvailable]) { |
63 _metalView = [[MTKView alloc] initWithFrame:self.bounds]; | 63 _metalView = [[MTKView alloc] initWithFrame:self.bounds]; |
64 [self addSubview:_metalView]; | 64 [self addSubview:_metalView]; |
65 _metalView.delegate = self; | 65 _metalView.delegate = self; |
66 _metalView.contentMode = UIViewContentModeScaleAspectFit; | 66 _metalView.contentMode = UIViewContentModeScaleAspectFit; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 - (void)renderFrame:(nullable RTCVideoFrame *)frame { | 99 - (void)renderFrame:(nullable RTCVideoFrame *)frame { |
100 if (frame == nil) { | 100 if (frame == nil) { |
101 RTCLogInfo(@"Incoming frame is nil. Exiting render callback."); | 101 RTCLogInfo(@"Incoming frame is nil. Exiting render callback."); |
102 return; | 102 return; |
103 } | 103 } |
104 self.videoFrame = frame; | 104 self.videoFrame = frame; |
105 } | 105 } |
106 | 106 |
107 @end | 107 @end |
OLD | NEW |