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 | |
| 13 | #import "webrtc/base/objc/NSString+StdString.h" |
| 14 | #import "webrtc/media/base/mediaconstants.h" |
| 15 | |
| 16 | const NSString * const kRtxCodecMimeType = @(cricket::kRtxCodecName); |
| 17 | const NSString * const kRedCodecMimeType = @(cricket::kRedCodecName); |
| 18 | const NSString * const kUlpfecCodecMimeType = @(cricket::kUlpfecCodecName); |
| 19 | const NSString * const kOpusCodecMimeType = @(cricket::kOpusCodecName); |
| 20 | const NSString * const kIsacCodecMimeType = @(cricket::kIsacCodecName); |
| 21 | const NSString * const kL16CodecMimeType = @(cricket::kL16CodecName); |
| 22 | const NSString * const kG722CodecMimeType = @(cricket::kG722CodecName); |
| 23 | const NSString * const kIlbcCodecMimeType = @(cricket::kIlbcCodecName); |
| 24 | const NSString * const kPcmuCodecMimeType = @(cricket::kPcmuCodecName); |
| 25 | const NSString * const kPcmaCodecMimeType = @(cricket::kPcmaCodecName); |
| 26 | const NSString * const kDtmfCodecMimeType = @(cricket::kDtmfCodecName); |
| 27 | const NSString * const kComfortNoiseCodecMimeType = @(cricket::kComfortNoiseCodecName); |
| 28 | const NSString * const kVp8CodecMimeType = @(cricket::kVp8CodecName); |
| 29 | const NSString * const kVp9CodecMimeType = @(cricket::kVp9CodecName); |
| 30 | const NSString * const kH264CodecMimeType = @(cricket::kH264CodecName); |
| 31 | |
| 32 | @implementation RTCRtpCodecParameters |
| 33 | |
| 34 | @synthesize payloadType = _payloadType; |
| 35 | @synthesize mimeType = _mimeType; |
| 36 | @synthesize clockRate = _clockRate; |
| 37 | @synthesize channels = _channels; |
| 38 | |
| 39 | - (instancetype)init { |
| 40 | return [super init]; |
| 41 | } |
| 42 | |
| 43 | - (instancetype)initWithNativeParameters: |
| 44 | (const webrtc::RtpCodecParameters &)nativeParameters { |
| 45 | if (self = [self init]) { |
| 46 | _payloadType = nativeParameters.payload_type; |
| 47 | _mimeType = [NSString stringForStdString:nativeParameters.mime_type]; |
| 48 | _clockRate = nativeParameters.clock_rate; |
| 49 | _channels = nativeParameters.channels; |
| 50 | } |
| 51 | return self; |
| 52 | } |
| 53 | |
| 54 | - (webrtc::RtpCodecParameters)nativeParameters { |
| 55 | webrtc::RtpCodecParameters parameters; |
| 56 | parameters.payload_type = _payloadType; |
| 57 | parameters.mime_type = [NSString stdStringForString:_mimeType]; |
| 58 | parameters.clock_rate = _clockRate; |
| 59 | parameters.channels = _channels; |
| 60 | return parameters; |
| 61 | } |
| 62 | |
| 63 | @end |