Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
tkchin | 9eeb624 | 2016-04-27 01:54:20 -0700 | [diff] [blame] | 13 | #import "NSString+StdString.h" |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 14 | |
tkchin | 9eeb624 | 2016-04-27 01:54:20 -0700 | [diff] [blame] | 15 | #include "webrtc/media/base/mediaconstants.h" |
| 16 | |
| 17 | const NSString * const kRTCRtxCodecMimeType = @(cricket::kRtxCodecName); |
| 18 | const NSString * const kRTCRedCodecMimeType = @(cricket::kRedCodecName); |
| 19 | const NSString * const kRTCUlpfecCodecMimeType = @(cricket::kUlpfecCodecName); |
brandtr | 87d7d77 | 2016-11-07 03:03:41 -0800 | [diff] [blame] | 20 | const NSString * const kRTCFlexfecCodecMimeType = @(cricket::kFlexfecCodecName); |
tkchin | 9eeb624 | 2016-04-27 01:54:20 -0700 | [diff] [blame] | 21 | const NSString * const kRTCOpusCodecMimeType = @(cricket::kOpusCodecName); |
| 22 | const NSString * const kRTCIsacCodecMimeType = @(cricket::kIsacCodecName); |
| 23 | const NSString * const kRTCL16CodecMimeType = @(cricket::kL16CodecName); |
| 24 | const NSString * const kRTCG722CodecMimeType = @(cricket::kG722CodecName); |
| 25 | const NSString * const kRTCIlbcCodecMimeType = @(cricket::kIlbcCodecName); |
| 26 | const NSString * const kRTCPcmuCodecMimeType = @(cricket::kPcmuCodecName); |
| 27 | const NSString * const kRTCPcmaCodecMimeType = @(cricket::kPcmaCodecName); |
| 28 | const NSString * const kRTCDtmfCodecMimeType = @(cricket::kDtmfCodecName); |
| 29 | const NSString * const kRTCComfortNoiseCodecMimeType = |
| 30 | @(cricket::kComfortNoiseCodecName); |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 31 | const NSString * const kVp8CodecMimeType = @(cricket::kVp8CodecName); |
| 32 | const NSString * const kVp9CodecMimeType = @(cricket::kVp9CodecName); |
| 33 | const 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 |