Add prefix to codec name constants.

Bug: webrtc:8401
Change-Id: I8cd4685df3609e8b91a79b19789aadef484138d4
Reviewed-on: https://webrtc-review.googlesource.com/14140
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20390}
This commit is contained in:
Kári Tristan Helgason
2017-10-20 11:01:22 +02:00
committed by Commit Bot
parent 47217364f5
commit fc313dcda6
6 changed files with 28 additions and 27 deletions

View File

@ -21,11 +21,11 @@
@synthesize preferredCodec; @synthesize preferredCodec;
- (id<RTCVideoEncoder>)createEncoder:(RTCVideoCodecInfo *)info { - (id<RTCVideoEncoder>)createEncoder:(RTCVideoCodecInfo *)info {
if ([info.name isEqualToString:kVideoCodecH264Name]) { if ([info.name isEqualToString:kRTCVideoCodecH264Name]) {
return [[RTCVideoEncoderH264 alloc] initWithCodecInfo:info]; return [[RTCVideoEncoderH264 alloc] initWithCodecInfo:info];
} else if ([info.name isEqualToString:kVideoCodecVp8Name]) { } else if ([info.name isEqualToString:kRTCVideoCodecVp8Name]) {
return [RTCVideoEncoderVP8 vp8Encoder]; return [RTCVideoEncoderVP8 vp8Encoder];
} else if ([info.name isEqualToString:kVideoCodecVp9Name]) { } else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) {
return [RTCVideoEncoderVP9 vp9Encoder]; return [RTCVideoEncoderVP9 vp9Encoder];
} }
@ -36,30 +36,31 @@
NSMutableArray<RTCVideoCodecInfo *> *codecs = [NSMutableArray array]; NSMutableArray<RTCVideoCodecInfo *> *codecs = [NSMutableArray array];
NSDictionary<NSString *, NSString *> *constrainedHighParams = @{ NSDictionary<NSString *, NSString *> *constrainedHighParams = @{
@"profile-level-id" : kLevel31ConstrainedHigh, @"profile-level-id" : kRTCLevel31ConstrainedHigh,
@"level-asymmetry-allowed" : @"1", @"level-asymmetry-allowed" : @"1",
@"packetization-mode" : @"1", @"packetization-mode" : @"1",
}; };
RTCVideoCodecInfo *constrainedHighInfo = RTCVideoCodecInfo *constrainedHighInfo =
[[RTCVideoCodecInfo alloc] initWithName:kVideoCodecH264Name parameters:constrainedHighParams]; [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name
parameters:constrainedHighParams];
[codecs addObject:constrainedHighInfo]; [codecs addObject:constrainedHighInfo];
NSDictionary<NSString *, NSString *> *constrainedBaselineParams = @{ NSDictionary<NSString *, NSString *> *constrainedBaselineParams = @{
@"profile-level-id" : kLevel31ConstrainedBaseline, @"profile-level-id" : kRTCLevel31ConstrainedBaseline,
@"level-asymmetry-allowed" : @"1", @"level-asymmetry-allowed" : @"1",
@"packetization-mode" : @"1", @"packetization-mode" : @"1",
}; };
RTCVideoCodecInfo *constrainedBaselineInfo = RTCVideoCodecInfo *constrainedBaselineInfo =
[[RTCVideoCodecInfo alloc] initWithName:kVideoCodecH264Name [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name
parameters:constrainedBaselineParams]; parameters:constrainedBaselineParams];
[codecs addObject:constrainedBaselineInfo]; [codecs addObject:constrainedBaselineInfo];
RTCVideoCodecInfo *vp8Info = RTCVideoCodecInfo *vp8Info =
[[RTCVideoCodecInfo alloc] initWithName:kVideoCodecVp8Name parameters:nil]; [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name parameters:nil];
[codecs addObject:vp8Info]; [codecs addObject:vp8Info];
RTCVideoCodecInfo *vp9Info = RTCVideoCodecInfo *vp9Info =
[[RTCVideoCodecInfo alloc] initWithName:kVideoCodecVp9Name parameters:nil]; [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters:nil];
[codecs addObject:vp9Info]; [codecs addObject:vp9Info];
NSMutableArray<RTCVideoCodecInfo *> *orderedCodecs = [NSMutableArray array]; NSMutableArray<RTCVideoCodecInfo *> *orderedCodecs = [NSMutableArray array];

View File

@ -14,11 +14,11 @@
#import "RTCVideoCodec+Private.h" #import "RTCVideoCodec+Private.h"
#import "WebRTC/RTCVideoCodecFactory.h" #import "WebRTC/RTCVideoCodecFactory.h"
NSString *const kVideoCodecVp8Name = @"VP8"; NSString *const kRTCVideoCodecVp8Name = @"VP8";
NSString *const kVideoCodecVp9Name = @"VP9"; NSString *const kRTCVideoCodecVp9Name = @"VP9";
NSString *const kVideoCodecH264Name = @"H264"; NSString *const kRTCVideoCodecH264Name = @"H264";
NSString *const kLevel31ConstrainedHigh = @"640c1f"; NSString *const kRTCLevel31ConstrainedHigh = @"640c1f";
NSString *const kLevel31ConstrainedBaseline = @"42e01f"; NSString *const kRTCLevel31ConstrainedBaseline = @"42e01f";
@implementation RTCVideoCodecInfo @implementation RTCVideoCodecInfo

View File

@ -33,7 +33,7 @@ bool IsHighProfileEnabled() {
- (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo { - (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo {
webrtc::CodecSpecificInfo codecSpecificInfo; webrtc::CodecSpecificInfo codecSpecificInfo;
codecSpecificInfo.codecType = webrtc::kVideoCodecH264; codecSpecificInfo.codecType = webrtc::kVideoCodecH264;
codecSpecificInfo.codec_name = [kVideoCodecH264Name cStringUsingEncoding:NSUTF8StringEncoding]; codecSpecificInfo.codec_name = [kRTCVideoCodecH264Name cStringUsingEncoding:NSUTF8StringEncoding];
codecSpecificInfo.codecSpecific.H264.packetization_mode = codecSpecificInfo.codecSpecific.H264.packetization_mode =
(webrtc::H264PacketizationMode)_packetizationMode; (webrtc::H264PacketizationMode)_packetizationMode;
@ -47,11 +47,11 @@ bool IsHighProfileEnabled() {
- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
NSMutableArray<RTCVideoCodecInfo *> *codecs = [NSMutableArray array]; NSMutableArray<RTCVideoCodecInfo *> *codecs = [NSMutableArray array];
NSString *codecName = kVideoCodecH264Name; NSString *codecName = kRTCVideoCodecH264Name;
if (IsHighProfileEnabled()) { if (IsHighProfileEnabled()) {
NSDictionary<NSString *, NSString *> *constrainedHighParams = @{ NSDictionary<NSString *, NSString *> *constrainedHighParams = @{
@"profile-level-id" : kLevel31ConstrainedHigh, @"profile-level-id" : kRTCLevel31ConstrainedHigh,
@"level-asymmetry-allowed" : @"1", @"level-asymmetry-allowed" : @"1",
@"packetization-mode" : @"1", @"packetization-mode" : @"1",
}; };
@ -61,7 +61,7 @@ bool IsHighProfileEnabled() {
} }
NSDictionary<NSString *, NSString *> *constrainedBaselineParams = @{ NSDictionary<NSString *, NSString *> *constrainedBaselineParams = @{
@"profile-level-id" : kLevel31ConstrainedBaseline, @"profile-level-id" : kRTCLevel31ConstrainedBaseline,
@"level-asymmetry-allowed" : @"1", @"level-asymmetry-allowed" : @"1",
@"packetization-mode" : @"1", @"packetization-mode" : @"1",
}; };
@ -86,7 +86,7 @@ bool IsHighProfileEnabled() {
} }
- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
NSString *codecName = kVideoCodecH264Name; NSString *codecName = kRTCVideoCodecH264Name;
return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ]; return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ];
} }

View File

@ -304,7 +304,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) {
_packetizationMode = RTCH264PacketizationModeNonInterleaved; _packetizationMode = RTCH264PacketizationModeNonInterleaved;
_profile = ExtractProfile([codecInfo nativeSdpVideoFormat]); _profile = ExtractProfile([codecInfo nativeSdpVideoFormat]);
LOG(LS_INFO) << "Using profile " << CFStringToString(_profile); LOG(LS_INFO) << "Using profile " << CFStringToString(_profile);
RTC_CHECK([codecInfo.name isEqualToString:kVideoCodecH264Name]); RTC_CHECK([codecInfo.name isEqualToString:kRTCVideoCodecH264Name]);
#if defined(WEBRTC_IOS) #if defined(WEBRTC_IOS)
[RTCUIApplicationStatusObserver prepareForUse]; [RTCUIApplicationStatusObserver prepareForUse];
@ -320,7 +320,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) {
- (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings - (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings
numberOfCores:(int)numberOfCores { numberOfCores:(int)numberOfCores {
RTC_DCHECK(settings); RTC_DCHECK(settings);
RTC_DCHECK([settings.name isEqualToString:kVideoCodecH264Name]); RTC_DCHECK([settings.name isEqualToString:kRTCVideoCodecH264Name]);
_width = settings.width; _width = settings.width;
_height = settings.height; _height = settings.height;

View File

@ -145,7 +145,7 @@ VideoEncoderFactory::CodecInfo ObjCVideoEncoderFactory::QueryVideoEncoder(
// TODO(andersc): This is a hack until we figure out how this should be done properly. // TODO(andersc): This is a hack until we figure out how this should be done properly.
NSString *formatName = [NSString stringForStdString:format.name]; NSString *formatName = [NSString stringForStdString:format.name];
NSSet *wrappedSoftwareFormats = NSSet *wrappedSoftwareFormats =
[NSSet setWithObjects:kVideoCodecVp8Name, kVideoCodecVp9Name, nil]; [NSSet setWithObjects:kRTCVideoCodecVp8Name, kRTCVideoCodecVp9Name, nil];
CodecInfo codec_info; CodecInfo codec_info;
codec_info.is_hardware_accelerated = ![wrappedSoftwareFormats containsObject:formatName]; codec_info.is_hardware_accelerated = ![wrappedSoftwareFormats containsObject:formatName];

View File

@ -15,11 +15,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
RTC_EXPORT extern NSString *const kVideoCodecVp8Name; RTC_EXPORT extern NSString *const kRTCVideoCodecVp8Name;
RTC_EXPORT extern NSString *const kVideoCodecVp9Name; RTC_EXPORT extern NSString *const kRTCVideoCodecVp9Name;
RTC_EXPORT extern NSString *const kVideoCodecH264Name; RTC_EXPORT extern NSString *const kRTCVideoCodecH264Name;
RTC_EXPORT extern NSString *const kLevel31ConstrainedHigh; RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedHigh;
RTC_EXPORT extern NSString *const kLevel31ConstrainedBaseline; RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedBaseline;
/** Represents an encoded frame's type. */ /** Represents an encoded frame's type. */
typedef NS_ENUM(NSUInteger, RTCFrameType) { typedef NS_ENUM(NSUInteger, RTCFrameType) {