diff --git a/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m b/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m index bdb18517ca..44445f4b13 100644 --- a/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m +++ b/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m @@ -21,6 +21,41 @@ @implementation RTCDefaultVideoDecoderFactory +- (NSArray *)supportedCodecs { + NSDictionary *constrainedHighParams = @{ + @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedHigh, + @"level-asymmetry-allowed" : @"1", + @"packetization-mode" : @"1", + }; + RTCVideoCodecInfo *constrainedHighInfo = + [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name + parameters:constrainedHighParams]; + + NSDictionary *constrainedBaselineParams = @{ + @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, + @"level-asymmetry-allowed" : @"1", + @"packetization-mode" : @"1", + }; + RTCVideoCodecInfo *constrainedBaselineInfo = + [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name + parameters:constrainedBaselineParams]; + + RTCVideoCodecInfo *vp8Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name]; + +#if defined(RTC_ENABLE_VP9) + RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name]; +#endif + + return @[ + constrainedHighInfo, + constrainedBaselineInfo, + vp8Info, +#if defined(RTC_ENABLE_VP9) + vp9Info, +#endif + ]; +} + - (id)createDecoder:(RTCVideoCodecInfo *)info { if ([info.name isEqualToString:kRTCVideoCodecH264Name]) { return [[RTCVideoDecoderH264 alloc] init]; @@ -35,14 +70,4 @@ return nil; } -- (NSArray *)supportedCodecs { - return @[ - [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name], - [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name], -#if defined(RTC_ENABLE_VP9) - [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name], -#endif - ]; -} - @end diff --git a/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m b/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m index b9b9aa72c6..bf399c6e7b 100644 --- a/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m +++ b/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m @@ -15,13 +15,33 @@ @implementation RTCVideoDecoderFactoryH264 +- (NSArray *)supportedCodecs { + NSMutableArray *codecs = [NSMutableArray array]; + NSString *codecName = kRTCVideoCodecH264Name; + + NSDictionary *constrainedHighParams = @{ + @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedHigh, + @"level-asymmetry-allowed" : @"1", + @"packetization-mode" : @"1", + }; + RTCVideoCodecInfo *constrainedHighInfo = + [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:constrainedHighParams]; + [codecs addObject:constrainedHighInfo]; + + NSDictionary *constrainedBaselineParams = @{ + @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, + @"level-asymmetry-allowed" : @"1", + @"packetization-mode" : @"1", + }; + RTCVideoCodecInfo *constrainedBaselineInfo = + [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:constrainedBaselineParams]; + [codecs addObject:constrainedBaselineInfo]; + + return [codecs copy]; +} + - (id)createDecoder:(RTCVideoCodecInfo *)info { return [[RTCVideoDecoderH264 alloc] init]; } -- (NSArray *)supportedCodecs { - NSString *codecName = kRTCVideoCodecH264Name; - return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ]; -} - @end