blob: 770476947238ec09bb3c3184e2984555bcb8066f [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);
20const NSString * const kRTCOpusCodecMimeType = @(cricket::kOpusCodecName);
21const NSString * const kRTCIsacCodecMimeType = @(cricket::kIsacCodecName);
22const NSString * const kRTCL16CodecMimeType = @(cricket::kL16CodecName);
23const NSString * const kRTCG722CodecMimeType = @(cricket::kG722CodecName);
24const NSString * const kRTCIlbcCodecMimeType = @(cricket::kIlbcCodecName);
25const NSString * const kRTCPcmuCodecMimeType = @(cricket::kPcmuCodecName);
26const NSString * const kRTCPcmaCodecMimeType = @(cricket::kPcmaCodecName);
27const NSString * const kRTCDtmfCodecMimeType = @(cricket::kDtmfCodecName);
28const NSString * const kRTCComfortNoiseCodecMimeType =
29 @(cricket::kComfortNoiseCodecName);
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070030const NSString * const kVp8CodecMimeType = @(cricket::kVp8CodecName);
31const NSString * const kVp9CodecMimeType = @(cricket::kVp9CodecName);
32const NSString * const kH264CodecMimeType = @(cricket::kH264CodecName);
33
34@implementation RTCRtpCodecParameters
35
36@synthesize payloadType = _payloadType;
37@synthesize mimeType = _mimeType;
38@synthesize clockRate = _clockRate;
39@synthesize channels = _channels;
40
41- (instancetype)init {
42 return [super init];
43}
44
45- (instancetype)initWithNativeParameters:
46 (const webrtc::RtpCodecParameters &)nativeParameters {
47 if (self = [self init]) {
48 _payloadType = nativeParameters.payload_type;
49 _mimeType = [NSString stringForStdString:nativeParameters.mime_type];
50 _clockRate = nativeParameters.clock_rate;
51 _channels = nativeParameters.channels;
52 }
53 return self;
54}
55
56- (webrtc::RtpCodecParameters)nativeParameters {
57 webrtc::RtpCodecParameters parameters;
58 parameters.payload_type = _payloadType;
59 parameters.mime_type = [NSString stdStringForString:_mimeType];
60 parameters.clock_rate = _clockRate;
61 parameters.channels = _channels;
62 return parameters;
63}
64
65@end