blob: 40f4f251bf232d9fee86ae4c727ddb0b0b95cab7 [file] [log] [blame]
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -07001/*
2 * Copyright 2016 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 "RTCRtpCodecParameters+Private.h"
12
tkchin9eeb6242016-04-27 01:54:20 -070013#import "NSString+StdString.h"
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070014
tkchin9eeb6242016-04-27 01:54:20 -070015#include "webrtc/media/base/mediaconstants.h"
16
17const NSString * const kRTCRtxCodecMimeType = @(cricket::kRtxCodecName);
18const NSString * const kRTCRedCodecMimeType = @(cricket::kRedCodecName);
19const NSString * const kRTCUlpfecCodecMimeType = @(cricket::kUlpfecCodecName);
brandtr87d7d772016-11-07 03:03:41 -080020const NSString * const kRTCFlexfecCodecMimeType = @(cricket::kFlexfecCodecName);
tkchin9eeb6242016-04-27 01:54:20 -070021const NSString * const kRTCOpusCodecMimeType = @(cricket::kOpusCodecName);
22const NSString * const kRTCIsacCodecMimeType = @(cricket::kIsacCodecName);
23const NSString * const kRTCL16CodecMimeType = @(cricket::kL16CodecName);
24const NSString * const kRTCG722CodecMimeType = @(cricket::kG722CodecName);
25const NSString * const kRTCIlbcCodecMimeType = @(cricket::kIlbcCodecName);
26const NSString * const kRTCPcmuCodecMimeType = @(cricket::kPcmuCodecName);
27const NSString * const kRTCPcmaCodecMimeType = @(cricket::kPcmaCodecName);
28const NSString * const kRTCDtmfCodecMimeType = @(cricket::kDtmfCodecName);
29const NSString * const kRTCComfortNoiseCodecMimeType =
30 @(cricket::kComfortNoiseCodecName);
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070031const NSString * const kVp8CodecMimeType = @(cricket::kVp8CodecName);
32const NSString * const kVp9CodecMimeType = @(cricket::kVp9CodecName);
33const NSString * const kH264CodecMimeType = @(cricket::kH264CodecName);
34
35@implementation RTCRtpCodecParameters
36
37@synthesize payloadType = _payloadType;
38@synthesize mimeType = _mimeType;
39@synthesize clockRate = _clockRate;
40@synthesize channels = _channels;
41
42- (instancetype)init {
43 return [super init];
44}
45
46- (instancetype)initWithNativeParameters:
47 (const webrtc::RtpCodecParameters &)nativeParameters {
48 if (self = [self init]) {
49 _payloadType = nativeParameters.payload_type;
50 _mimeType = [NSString stringForStdString:nativeParameters.mime_type];
51 _clockRate = nativeParameters.clock_rate;
52 _channels = nativeParameters.channels;
53 }
54 return self;
55}
56
57- (webrtc::RtpCodecParameters)nativeParameters {
58 webrtc::RtpCodecParameters parameters;
59 parameters.payload_type = _payloadType;
60 parameters.mime_type = [NSString stdStringForString:_mimeType];
61 parameters.clock_rate = _clockRate;
62 parameters.channels = _channels;
63 return parameters;
64}
65
66@end