Don't create VP9 codec factories when building without VP9.

This fixes a bug where AppRTCMobile would crash at runtime when
built without VP9 support.

Bug: webrtc:8602
Change-Id: Id2db79c3ff8136f06dc049afcc5197e9356fd25b
Reviewed-on: https://webrtc-review.googlesource.com/27983
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20982}
This commit is contained in:
Kári Tristan Helgason
2017-12-01 14:27:07 +01:00
committed by Commit Bot
parent 897e136762
commit 9555e67db5
2 changed files with 19 additions and 1 deletions

View File

@ -13,7 +13,9 @@
#import "WebRTC/RTCVideoCodec.h"
#import "WebRTC/RTCVideoCodecH264.h"
#import "WebRTC/RTCVideoEncoderVP8.h"
#if !defined(RTC_DISABLE_VP9)
#import "WebRTC/RTCVideoEncoderVP9.h"
#endif
@implementation RTCDefaultVideoEncoderFactory
@ -40,9 +42,17 @@
RTCVideoCodecInfo *vp8Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name];
#if !defined(RTC_DISABLE_VP9)
RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
#endif
return @[ constrainedHighInfo, constrainedBaselineInfo, vp8Info, vp9Info ];
return @[ constrainedHighInfo,
constrainedBaselineInfo,
vp8Info,
#if !defined(RTC_DISABLE_VP9)
vp9Info
#endif
];
}
- (id<RTCVideoEncoder>)createEncoder:(RTCVideoCodecInfo *)info {
@ -50,8 +60,10 @@
return [[RTCVideoEncoderH264 alloc] initWithCodecInfo:info];
} else if ([info.name isEqualToString:kRTCVideoCodecVp8Name]) {
return [RTCVideoEncoderVP8 vp8Encoder];
#if !defined(RTC_DISABLE_VP9)
} else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) {
return [RTCVideoEncoderVP9 vp9Encoder];
#endif
}
return nil;