Fall-back to OpenGL renderer if mac hardware doesn't support Metal
BUG=webrtc:7782 Review-Url: https://codereview.webrtc.org/2927983002 Cr-Commit-Position: refs/heads/master@{#18539}
This commit is contained in:
parent
84b4d2c1c2
commit
42742a56ef
@ -221,10 +221,12 @@ static NSUInteger const kBottomViewHeight = 200;
|
||||
// If not we're providing sensible default.
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
if ([RTCMTLNSVideoView class]) {
|
||||
if ([RTCMTLNSVideoView class] && [RTCMTLNSVideoView isMetalAvailable]) {
|
||||
_remoteVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect];
|
||||
_localVideoView = [[RTCMTLNSVideoView alloc] initWithFrame:NSZeroRect];
|
||||
} else {
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
if (_remoteVideoView == nil) {
|
||||
NSOpenGLPixelFormatAttribute attributes[] = {
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
NSOpenGLPFADepthSize, 24,
|
||||
@ -245,7 +247,6 @@ static NSUInteger const kBottomViewHeight = 200;
|
||||
local.delegate = self;
|
||||
_localVideoView = local;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
[_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self addSubview:_remoteVideoView];
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
#pragma mark - Private
|
||||
|
||||
+ (BOOL)isMetalAvailable {
|
||||
return YES;
|
||||
return [MTLCopyAllDevices() count] > 0;
|
||||
}
|
||||
|
||||
- (void)configure {
|
||||
|
||||
@ -13,5 +13,5 @@
|
||||
|
||||
NS_AVAILABLE_MAC(10.11)
|
||||
@interface RTCMTLNSVideoView : NSView<RTCVideoRenderer>
|
||||
|
||||
+ (BOOL)isMetalAvailable;
|
||||
@end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user