From fc313dcda650fc4cd7dd4bb45e25eef3c500d6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1ri=20Tristan=20Helgason?= Date: Fri, 20 Oct 2017 11:01:22 +0200 Subject: [PATCH] Add prefix to codec name constants. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:8401 Change-Id: I8cd4685df3609e8b91a79b19789aadef484138d4 Reviewed-on: https://webrtc-review.googlesource.com/14140 Reviewed-by: Peter Hanspers Commit-Queue: Kári Helgason Cr-Commit-Position: refs/heads/master@{#20390} --- .../AppRTCMobile/ARDVideoEncoderFactory.m | 19 ++++++++++--------- .../Classes/PeerConnection/RTCVideoCodec.mm | 10 +++++----- .../PeerConnection/RTCVideoCodecH264.mm | 10 +++++----- .../VideoToolbox/RTCVideoEncoderH264.mm | 4 ++-- .../objc_video_encoder_factory.mm | 2 +- .../Framework/Headers/WebRTC/RTCVideoCodec.h | 10 +++++----- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/examples/objc/AppRTCMobile/ARDVideoEncoderFactory.m b/examples/objc/AppRTCMobile/ARDVideoEncoderFactory.m index b1163c4ff8..d6ca592548 100644 --- a/examples/objc/AppRTCMobile/ARDVideoEncoderFactory.m +++ b/examples/objc/AppRTCMobile/ARDVideoEncoderFactory.m @@ -21,11 +21,11 @@ @synthesize preferredCodec; - (id)createEncoder:(RTCVideoCodecInfo *)info { - if ([info.name isEqualToString:kVideoCodecH264Name]) { + if ([info.name isEqualToString:kRTCVideoCodecH264Name]) { return [[RTCVideoEncoderH264 alloc] initWithCodecInfo:info]; - } else if ([info.name isEqualToString:kVideoCodecVp8Name]) { + } else if ([info.name isEqualToString:kRTCVideoCodecVp8Name]) { return [RTCVideoEncoderVP8 vp8Encoder]; - } else if ([info.name isEqualToString:kVideoCodecVp9Name]) { + } else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) { return [RTCVideoEncoderVP9 vp9Encoder]; } @@ -36,30 +36,31 @@ NSMutableArray *codecs = [NSMutableArray array]; NSDictionary *constrainedHighParams = @{ - @"profile-level-id" : kLevel31ConstrainedHigh, + @"profile-level-id" : kRTCLevel31ConstrainedHigh, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; RTCVideoCodecInfo *constrainedHighInfo = - [[RTCVideoCodecInfo alloc] initWithName:kVideoCodecH264Name parameters:constrainedHighParams]; + [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name + parameters:constrainedHighParams]; [codecs addObject:constrainedHighInfo]; NSDictionary *constrainedBaselineParams = @{ - @"profile-level-id" : kLevel31ConstrainedBaseline, + @"profile-level-id" : kRTCLevel31ConstrainedBaseline, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; RTCVideoCodecInfo *constrainedBaselineInfo = - [[RTCVideoCodecInfo alloc] initWithName:kVideoCodecH264Name + [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name parameters:constrainedBaselineParams]; [codecs addObject:constrainedBaselineInfo]; RTCVideoCodecInfo *vp8Info = - [[RTCVideoCodecInfo alloc] initWithName:kVideoCodecVp8Name parameters:nil]; + [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name parameters:nil]; [codecs addObject:vp8Info]; RTCVideoCodecInfo *vp9Info = - [[RTCVideoCodecInfo alloc] initWithName:kVideoCodecVp9Name parameters:nil]; + [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters:nil]; [codecs addObject:vp9Info]; NSMutableArray *orderedCodecs = [NSMutableArray array]; diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm index 2a49189dfd..8886209fa1 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm @@ -14,11 +14,11 @@ #import "RTCVideoCodec+Private.h" #import "WebRTC/RTCVideoCodecFactory.h" -NSString *const kVideoCodecVp8Name = @"VP8"; -NSString *const kVideoCodecVp9Name = @"VP9"; -NSString *const kVideoCodecH264Name = @"H264"; -NSString *const kLevel31ConstrainedHigh = @"640c1f"; -NSString *const kLevel31ConstrainedBaseline = @"42e01f"; +NSString *const kRTCVideoCodecVp8Name = @"VP8"; +NSString *const kRTCVideoCodecVp9Name = @"VP9"; +NSString *const kRTCVideoCodecH264Name = @"H264"; +NSString *const kRTCLevel31ConstrainedHigh = @"640c1f"; +NSString *const kRTCLevel31ConstrainedBaseline = @"42e01f"; @implementation RTCVideoCodecInfo diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm index d7f9c19a73..f862453b5f 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm @@ -33,7 +33,7 @@ bool IsHighProfileEnabled() { - (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo { webrtc::CodecSpecificInfo codecSpecificInfo; codecSpecificInfo.codecType = webrtc::kVideoCodecH264; - codecSpecificInfo.codec_name = [kVideoCodecH264Name cStringUsingEncoding:NSUTF8StringEncoding]; + codecSpecificInfo.codec_name = [kRTCVideoCodecH264Name cStringUsingEncoding:NSUTF8StringEncoding]; codecSpecificInfo.codecSpecific.H264.packetization_mode = (webrtc::H264PacketizationMode)_packetizationMode; @@ -47,11 +47,11 @@ bool IsHighProfileEnabled() { - (NSArray *)supportedCodecs { NSMutableArray *codecs = [NSMutableArray array]; - NSString *codecName = kVideoCodecH264Name; + NSString *codecName = kRTCVideoCodecH264Name; if (IsHighProfileEnabled()) { NSDictionary *constrainedHighParams = @{ - @"profile-level-id" : kLevel31ConstrainedHigh, + @"profile-level-id" : kRTCLevel31ConstrainedHigh, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; @@ -61,7 +61,7 @@ bool IsHighProfileEnabled() { } NSDictionary *constrainedBaselineParams = @{ - @"profile-level-id" : kLevel31ConstrainedBaseline, + @"profile-level-id" : kRTCLevel31ConstrainedBaseline, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; @@ -86,7 +86,7 @@ bool IsHighProfileEnabled() { } - (NSArray *)supportedCodecs { - NSString *codecName = kVideoCodecH264Name; + NSString *codecName = kRTCVideoCodecH264Name; return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ]; } diff --git a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm b/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm index 79eb76398d..5b08e74b71 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm +++ b/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm @@ -304,7 +304,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) { _packetizationMode = RTCH264PacketizationModeNonInterleaved; _profile = ExtractProfile([codecInfo nativeSdpVideoFormat]); LOG(LS_INFO) << "Using profile " << CFStringToString(_profile); - RTC_CHECK([codecInfo.name isEqualToString:kVideoCodecH264Name]); + RTC_CHECK([codecInfo.name isEqualToString:kRTCVideoCodecH264Name]); #if defined(WEBRTC_IOS) [RTCUIApplicationStatusObserver prepareForUse]; @@ -320,7 +320,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) { - (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings numberOfCores:(int)numberOfCores { RTC_DCHECK(settings); - RTC_DCHECK([settings.name isEqualToString:kVideoCodecH264Name]); + RTC_DCHECK([settings.name isEqualToString:kRTCVideoCodecH264Name]); _width = settings.width; _height = settings.height; diff --git a/sdk/objc/Framework/Classes/VideoToolbox/objc_video_encoder_factory.mm b/sdk/objc/Framework/Classes/VideoToolbox/objc_video_encoder_factory.mm index d7601cf3fa..9e76626b7d 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/objc_video_encoder_factory.mm +++ b/sdk/objc/Framework/Classes/VideoToolbox/objc_video_encoder_factory.mm @@ -145,7 +145,7 @@ VideoEncoderFactory::CodecInfo ObjCVideoEncoderFactory::QueryVideoEncoder( // TODO(andersc): This is a hack until we figure out how this should be done properly. NSString *formatName = [NSString stringForStdString:format.name]; NSSet *wrappedSoftwareFormats = - [NSSet setWithObjects:kVideoCodecVp8Name, kVideoCodecVp9Name, nil]; + [NSSet setWithObjects:kRTCVideoCodecVp8Name, kRTCVideoCodecVp9Name, nil]; CodecInfo codec_info; codec_info.is_hardware_accelerated = ![wrappedSoftwareFormats containsObject:formatName]; diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h index 59c69e0e0b..ab17ce4fc8 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h @@ -15,11 +15,11 @@ NS_ASSUME_NONNULL_BEGIN -RTC_EXPORT extern NSString *const kVideoCodecVp8Name; -RTC_EXPORT extern NSString *const kVideoCodecVp9Name; -RTC_EXPORT extern NSString *const kVideoCodecH264Name; -RTC_EXPORT extern NSString *const kLevel31ConstrainedHigh; -RTC_EXPORT extern NSString *const kLevel31ConstrainedBaseline; +RTC_EXPORT extern NSString *const kRTCVideoCodecVp8Name; +RTC_EXPORT extern NSString *const kRTCVideoCodecVp9Name; +RTC_EXPORT extern NSString *const kRTCVideoCodecH264Name; +RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedHigh; +RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedBaseline; /** Represents an encoded frame's type. */ typedef NS_ENUM(NSUInteger, RTCFrameType) {