blob: 6c18cf3ebba32316f7745e33ed12211920c9591c [file] [log] [blame]
Anders Carlsson6bf43d22017-10-16 13:51:43 +02001/*
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"
Piasy Xu69b03e92018-08-28 00:44:51 +080012#import "WebRTC/RTCVideoCodecH264.h"
Anders Carlsson6bf43d22017-10-16 13:51:43 +020013
14@implementation RTCVideoCodecInfo (HumanReadable)
15
16- (NSString *)humanReadableDescription {
17 if ([self.name isEqualToString:@"H264"]) {
18 NSString *profileId = self.parameters[@"profile-level-id"];
Piasy Xu69b03e92018-08-28 00:44:51 +080019 RTCH264ProfileLevelId *profileLevelId =
20 [[RTCH264ProfileLevelId alloc] initWithHexString:profileId];
21 if (profileLevelId.profile == RTCH264ProfileConstrainedHigh ||
22 profileLevelId.profile == RTCH264ProfileHigh) {
Anders Carlsson6bf43d22017-10-16 13:51:43 +020023 return @"H264 (High)";
Piasy Xu69b03e92018-08-28 00:44:51 +080024 } else if (profileLevelId.profile == RTCH264ProfileConstrainedBaseline ||
25 profileLevelId.profile == RTCH264ProfileBaseline) {
Anders Carlsson6bf43d22017-10-16 13:51:43 +020026 return @"H264 (Baseline)";
27 } else {
28 return [NSString stringWithFormat:@"H264 (%@)", profileId];
29 }
30 } else {
31 return self.name;
32 }
33}
34
35@end