RTCVideoCodecInfo+HumanReadable.m (1358B)
1 /* 2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #import "RTCVideoCodecInfo+HumanReadable.h" 12 13 #import "sdk/objc/components/video_codec/RTCH264ProfileLevelId.h" 14 15 @implementation RTC_OBJC_TYPE (RTCVideoCodecInfo) 16 (HumanReadable) 17 18 - (NSString *)humanReadableDescription { 19 if ([self.name isEqualToString:@"H264"]) { 20 NSString *profileId = self.parameters[@"profile-level-id"]; 21 RTC_OBJC_TYPE(RTCH264ProfileLevelId) *profileLevelId = 22 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] 23 initWithHexString:profileId]; 24 if (profileLevelId.profile == RTCH264ProfileConstrainedHigh || 25 profileLevelId.profile == RTCH264ProfileHigh) { 26 return @"H264 (High)"; 27 } else if (profileLevelId.profile == RTCH264ProfileConstrainedBaseline || 28 profileLevelId.profile == RTCH264ProfileBaseline) { 29 return @"H264 (Baseline)"; 30 } else { 31 return [NSString stringWithFormat:@"H264 (%@)", profileId]; 32 } 33 } else { 34 return self.name; 35 } 36 } 37 38 @end