Chromium Code Reviews| Index: webrtc/api/objc/RTCRtpEncodingParameters.mm |
| diff --git a/webrtc/api/objc/RTCRtpEncodingParameters.mm b/webrtc/api/objc/RTCRtpEncodingParameters.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..09c53133deb36b867e9c9dfd80e02c87bf4380c0 |
| --- /dev/null |
| +++ b/webrtc/api/objc/RTCRtpEncodingParameters.mm |
| @@ -0,0 +1,49 @@ |
| +/* |
| + * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#import "RTCRtpEncodingParameters+Private.h" |
| + |
| +@implementation RTCRtpEncodingParameters |
| + |
| +@synthesize isActive = _isActive; |
| +@synthesize maxBitrateBps = _maxBitrateBps; |
| + |
| +static const int kBitrateUnlimited = -1; |
| + |
| +- (webrtc::RtpEncodingParameters)nativeParameters { |
| + webrtc::RtpEncodingParameters parameters; |
| + parameters.active = _isActive; |
| + if (_maxBitrateBps != nil) { |
| + parameters.max_bitrate_bps = [_maxBitrateBps intValue]; |
|
tkchin_webrtc
2016/04/06 22:04:48
dot syntax for properties
skvlad
2016/04/08 19:33:18
Done.
|
| + } |
| + return parameters; |
| +} |
| + |
| +- (instancetype)initWithNativeParameters: |
| + (const webrtc::RtpEncodingParameters &)nativeParameters { |
| + if ([self init]) { |
| + _isActive = nativeParameters.active; |
| + //TODO(skvlad): Replace with rtc::Optional once the C++ code is updated. |
|
tkchin_webrtc
2016/04/06 22:04:48
nit: space after. // TODO
skvlad
2016/04/08 19:33:19
Done.
|
| + if (nativeParameters.max_bitrate_bps != kBitrateUnlimited) { |
| + _maxBitrateBps = |
| + [NSNumber numberWithInt:nativeParameters.max_bitrate_bps]; |
| + } else { |
| + _maxBitrateBps = nil; |
|
tkchin_webrtc
2016/04/06 22:04:48
not needed. ivar objects are initialized to nil
skvlad
2016/04/08 19:33:19
Done. I thought this made it clearer that the valu
|
| + } |
| + } |
| + return self; |
| +} |
| + |
| +- (instancetype)init { |
|
tkchin_webrtc
2016/04/06 22:04:48
this should be declared after static const int kBi
skvlad
2016/04/08 19:33:19
Done.
|
| + self = [super init]; |
| + return self; |
| +} |
| + |
| +@end |