Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLNSVideoView.m

Issue 2927983002: Fall-back to OpenGL renderer if mac hardware doesn't support Metal (Closed)
Patch Set: Implement +isMetalAvailable with a runtime check Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 self = [super initWithCoder:aCoder]; 43 self = [super initWithCoder:aCoder];
44 if (self) { 44 if (self) {
45 [self configure]; 45 [self configure];
46 } 46 }
47 return self; 47 return self;
48 } 48 }
49 49
50 #pragma mark - Private 50 #pragma mark - Private
51 51
52 + (BOOL)isMetalAvailable { 52 + (BOOL)isMetalAvailable {
53 return YES; 53 return [MTLCopyAllDevices() count] > 0;
54 } 54 }
55 55
56 - (void)configure { 56 - (void)configure {
57 if ([[self class] isMetalAvailable]) { 57 if ([[self class] isMetalAvailable]) {
58 _metalView = [[MTKView alloc] initWithFrame:self.bounds]; 58 _metalView = [[MTKView alloc] initWithFrame:self.bounds];
59 [self addSubview:_metalView]; 59 [self addSubview:_metalView];
60 _metalView.layerContentsPlacement = NSViewLayerContentsPlacementScaleProport ionallyToFit; 60 _metalView.layerContentsPlacement = NSViewLayerContentsPlacementScaleProport ionallyToFit;
61 _metalView.translatesAutoresizingMaskIntoConstraints = NO; 61 _metalView.translatesAutoresizingMaskIntoConstraints = NO;
62 _metalView.framebufferOnly = YES; 62 _metalView.framebufferOnly = YES;
63 _metalView.delegate = self; 63 _metalView.delegate = self;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 - (void)renderFrame:(nullable RTCVideoFrame *)frame { 111 - (void)renderFrame:(nullable RTCVideoFrame *)frame {
112 if (frame == nil) { 112 if (frame == nil) {
113 return; 113 return;
114 } 114 }
115 self.videoFrame = [frame newI420VideoFrame]; 115 self.videoFrame = [frame newI420VideoFrame];
116 } 116 }
117 117
118 @end 118 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698