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

Side by Side Diff: webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.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
« no previous file with comments | « no previous file | webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLNSVideoView.m » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2014 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; 214 [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
215 [_scrollView setHasVerticalScroller:YES]; 215 [_scrollView setHasVerticalScroller:YES];
216 [_scrollView setDocumentView:_logView]; 216 [_scrollView setDocumentView:_logView];
217 [self addSubview:_scrollView]; 217 [self addSubview:_scrollView];
218 218
219 // NOTE (daniela): Ignoring Clang diagonstic here. 219 // NOTE (daniela): Ignoring Clang diagonstic here.
220 // We're performing run time check to make sure class is available on runtime. 220 // We're performing run time check to make sure class is available on runtime.
221 // If not we're providing sensible default. 221 // If not we're providing sensible default.
222 #pragma clang diagnostic push 222 #pragma clang diagnostic push
223 #pragma clang diagnostic ignored "-Wpartial-availability" 223 #pragma clang diagnostic ignored "-Wpartial-availability"
224 if ([RTCMTLNSVideoView class]) { 224 if ([RTCMTLNSVideoView class] && [RTCMTLNSVideoView isMetalAvailable]) {
225 _remoteVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect]; 225 _remoteVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect];
226 _localVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect]; 226 _localVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect];
227 } else { 227 }
228 #pragma clang diagnostic pop
229 if (_remoteVideoView == nil) {
228 NSOpenGLPixelFormatAttribute attributes[] = { 230 NSOpenGLPixelFormatAttribute attributes[] = {
229 NSOpenGLPFADoubleBuffer, 231 NSOpenGLPFADoubleBuffer,
230 NSOpenGLPFADepthSize, 24, 232 NSOpenGLPFADepthSize, 24,
231 NSOpenGLPFAOpenGLProfile, 233 NSOpenGLPFAOpenGLProfile,
232 NSOpenGLProfileVersion3_2Core, 234 NSOpenGLProfileVersion3_2Core,
233 0 235 0
234 }; 236 };
235 NSOpenGLPixelFormat* pixelFormat = 237 NSOpenGLPixelFormat* pixelFormat =
236 [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; 238 [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
237 239
238 RTCNSGLVideoView* remote = 240 RTCNSGLVideoView* remote =
239 [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelForm at]; 241 [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelForm at];
240 remote.delegate = self; 242 remote.delegate = self;
241 _remoteVideoView = remote; 243 _remoteVideoView = remote;
242 244
243 RTCNSGLVideoView* local = 245 RTCNSGLVideoView* local =
244 [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelForm at]; 246 [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect pixelFormat:pixelForm at];
245 local.delegate = self; 247 local.delegate = self;
246 _localVideoView = local; 248 _localVideoView = local;
247 } 249 }
248 #pragma clang diagnostic pop
249 250
250 [_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; 251 [_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
251 [self addSubview:_remoteVideoView]; 252 [self addSubview:_remoteVideoView];
252 [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; 253 [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
253 [self addSubview:_localVideoView]; 254 [self addSubview:_localVideoView];
254 } 255 }
255 256
256 - (void)setupActionItemsView { 257 - (void)setupActionItemsView {
257 _actionItemsView = [[NSView alloc] initWithFrame:NSZeroRect]; 258 _actionItemsView = [[NSView alloc] initWithFrame:NSZeroRect];
258 [_actionItemsView setTranslatesAutoresizingMaskIntoConstraints:NO]; 259 [_actionItemsView setTranslatesAutoresizingMaskIntoConstraints:NO];
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 429 }
429 430
430 - (void)disconnect { 431 - (void)disconnect {
431 [self resetUI]; 432 [self resetUI];
432 [_captureController stopCapture]; 433 [_captureController stopCapture];
433 _captureController = nil; 434 _captureController = nil;
434 [_client disconnect]; 435 [_client disconnect];
435 } 436 }
436 437
437 @end 438 @end
OLDNEW
« no previous file with comments | « no previous file | webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLNSVideoView.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698