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 "RTCRtpEncodingParameters+Private.h" | 11 #import "RTCRtpEncodingParameters+Private.h" |
12 | 12 |
13 @implementation RTCRtpEncodingParameters | 13 @implementation RTCRtpEncodingParameters |
14 | 14 |
15 @synthesize isActive = _isActive; | 15 @synthesize isActive = _isActive; |
16 @synthesize maxBitrateBps = _maxBitrateBps; | 16 @synthesize maxBitrateBps = _maxBitrateBps; |
17 @synthesize ssrc = _ssrc; | |
17 | 18 |
18 static const int kBitrateUnlimited = -1; | 19 static const int kBitrateUnlimited = -1; |
19 | 20 |
20 - (instancetype)init { | 21 - (instancetype)init { |
21 return [super init]; | 22 return [super init]; |
22 } | 23 } |
23 | 24 |
24 - (instancetype)initWithNativeParameters: | 25 - (instancetype)initWithNativeParameters: |
25 (const webrtc::RtpEncodingParameters &)nativeParameters { | 26 (const webrtc::RtpEncodingParameters &)nativeParameters { |
26 if (self = [self init]) { | 27 if (self = [self init]) { |
27 _isActive = nativeParameters.active; | 28 _isActive = nativeParameters.active; |
28 // TODO(skvlad): Replace with rtc::Optional once the C++ code is updated. | 29 // TODO(skvlad): Replace with rtc::Optional once the C++ code is updated. |
29 if (nativeParameters.max_bitrate_bps != kBitrateUnlimited) { | 30 if (nativeParameters.max_bitrate_bps != kBitrateUnlimited) { |
30 _maxBitrateBps = | 31 _maxBitrateBps = |
31 [NSNumber numberWithInt:nativeParameters.max_bitrate_bps]; | 32 [NSNumber numberWithInt:nativeParameters.max_bitrate_bps]; |
32 } | 33 } |
34 if (nativeParameters.ssrc) { | |
35 _ssrc = [NSNumber numberWithUnsignedLong:*nativeParameters.ssrc]; | |
tkchin_webrtc
2017/01/05 22:25:14
for my own knowledge - is int in C++ 32 or 64 bit?
Taylor Brandstetter
2017/01/05 22:47:27
Technically speaking, it's only guaranteed to be 1
tkchin_webrtc
2017/01/05 23:36:45
Ok. I just noticed this is a settable property, as
Taylor Brandstetter
2017/01/06 00:19:07
Actually, it's not meant to be settable in the fir
| |
36 } | |
33 } | 37 } |
34 return self; | 38 return self; |
35 } | 39 } |
36 | 40 |
37 - (webrtc::RtpEncodingParameters)nativeParameters { | 41 - (webrtc::RtpEncodingParameters)nativeParameters { |
38 webrtc::RtpEncodingParameters parameters; | 42 webrtc::RtpEncodingParameters parameters; |
39 parameters.active = _isActive; | 43 parameters.active = _isActive; |
40 if (_maxBitrateBps != nil) { | 44 if (_maxBitrateBps != nil) { |
41 parameters.max_bitrate_bps = _maxBitrateBps.intValue; | 45 parameters.max_bitrate_bps = _maxBitrateBps.intValue; |
42 } | 46 } |
47 if (_ssrc != nil) { | |
48 parameters.ssrc = rtc::Optional<uint32_t>(_ssrc.unsignedLongValue); | |
49 } | |
43 return parameters; | 50 return parameters; |
44 } | 51 } |
45 | 52 |
46 @end | 53 @end |
OLD | NEW |