blob: d0bf1b5c5bf202382b7e6bb9657cf26a6dea1072 [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"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020012
13#import <WebRTC/RTCH264ProfileLevelId.h>
Anders Carlsson6bf43d22017-10-16 13:51:43 +020014
15@implementation RTCVideoCodecInfo (HumanReadable)
16
17- (NSString *)humanReadableDescription {
18 if ([self.name isEqualToString:@"H264"]) {
19 NSString *profileId = self.parameters[@"profile-level-id"];
Piasy Xu69b03e92018-08-28 00:44:51 +080020 RTCH264ProfileLevelId *profileLevelId =
21 [[RTCH264ProfileLevelId alloc] initWithHexString:profileId];
22 if (profileLevelId.profile == RTCH264ProfileConstrainedHigh ||
23 profileLevelId.profile == RTCH264ProfileHigh) {
Anders Carlsson6bf43d22017-10-16 13:51:43 +020024 return @"H264 (High)";
Piasy Xu69b03e92018-08-28 00:44:51 +080025 } else if (profileLevelId.profile == RTCH264ProfileConstrainedBaseline ||
26 profileLevelId.profile == RTCH264ProfileBaseline) {
Anders Carlsson6bf43d22017-10-16 13:51:43 +020027 return @"H264 (Baseline)";
28 } else {
29 return [NSString stringWithFormat:@"H264 (%@)", profileId];
30 }
31 } else {
32 return self.name;
33 }
34}
35
36@end