OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #import "RTCRtpParameters+Private.h" | 11 #import "RTCRtpParameters+Private.h" |
| 12 |
| 13 #import "RTCRtpCodecParameters+Private.h" |
12 #import "RTCRtpEncodingParameters+Private.h" | 14 #import "RTCRtpEncodingParameters+Private.h" |
13 | 15 |
14 @implementation RTCRtpParameters | 16 @implementation RTCRtpParameters |
15 | 17 |
16 @synthesize encodings = _encodings; | 18 @synthesize encodings = _encodings; |
| 19 @synthesize codecs = _codecs; |
17 | 20 |
18 - (instancetype)init { | 21 - (instancetype)init { |
19 return [super init]; | 22 return [super init]; |
20 } | 23 } |
21 | 24 |
22 - (instancetype)initWithNativeParameters: | 25 - (instancetype)initWithNativeParameters: |
23 (const webrtc::RtpParameters &)nativeParameters { | 26 (const webrtc::RtpParameters &)nativeParameters { |
24 if (self = [self init]) { | 27 if (self = [self init]) { |
25 NSMutableArray *encodings = [[NSMutableArray alloc] init]; | 28 NSMutableArray *encodings = [[NSMutableArray alloc] init]; |
26 for (const auto &encoding : nativeParameters.encodings) { | 29 for (const auto &encoding : nativeParameters.encodings) { |
27 [encodings addObject:[[RTCRtpEncodingParameters alloc] | 30 [encodings addObject:[[RTCRtpEncodingParameters alloc] |
28 initWithNativeParameters:encoding]]; | 31 initWithNativeParameters:encoding]]; |
29 } | 32 } |
30 _encodings = encodings; | 33 _encodings = encodings; |
| 34 |
| 35 NSMutableArray *codecs = [[NSMutableArray alloc] init]; |
| 36 for (const auto &codec : nativeParameters.codecs) { |
| 37 [codecs addObject:[[RTCRtpCodecParameters alloc] |
| 38 initWithNativeParameters:codec]]; |
| 39 } |
| 40 _codecs = codecs; |
31 } | 41 } |
32 return self; | 42 return self; |
33 } | 43 } |
34 | 44 |
35 - (webrtc::RtpParameters)nativeParameters { | 45 - (webrtc::RtpParameters)nativeParameters { |
36 webrtc::RtpParameters parameters; | 46 webrtc::RtpParameters parameters; |
37 for (RTCRtpEncodingParameters *encoding in _encodings) { | 47 for (RTCRtpEncodingParameters *encoding in _encodings) { |
38 parameters.encodings.push_back(encoding.nativeParameters); | 48 parameters.encodings.push_back(encoding.nativeParameters); |
39 } | 49 } |
| 50 for (RTCRtpCodecParameters *codec in _codecs) { |
| 51 parameters.codecs.push_back(codec.nativeParameters); |
| 52 } |
40 return parameters; | 53 return parameters; |
41 } | 54 } |
42 | 55 |
43 @end | 56 @end |
OLD | NEW |