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..a4816ba8a25b029f4251fb6c809f3247c8ea544e |
| --- /dev/null |
| +++ b/webrtc/api/objc/RTCRtpEncodingParameters.mm |
| @@ -0,0 +1,43 @@ |
| +/* |
| + * 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 maxBitrateBps = _maxBitrateBps; |
| +@synthesize active = _active; |
| + |
| +const int kBitrateUnlimited = -1; |
|
tkchin_webrtc
2016/04/05 18:48:15
no namespace, so either static linkage or prefix:
skvlad
2016/04/05 23:21:27
Made static.
|
| + |
| +- (webrtc::RtpEncodingParameters)nativeParameters { |
| + webrtc::RtpEncodingParameters parameters; |
| + parameters.active = self.active; |
|
tkchin_webrtc
2016/04/05 18:48:15
usually we just access instance variable directly
skvlad
2016/04/05 23:21:28
Done.
|
| + if (self.maxBitrateBps != nil) { |
| + parameters.max_bitrate_bps = [self.maxBitrateBps intValue]; |
| + } |
| + return parameters; |
| +} |
| + |
| +- (instancetype)initWithNativeParameters: |
| + (const webrtc::RtpEncodingParameters&)nativeParameters { |
| + if (self = [super init]) { |
| + if (nativeParameters.max_bitrate_bps != kBitrateUnlimited) { |
|
tkchin_webrtc
2016/04/05 18:48:15
isn't there a C++ equivalent of unlimited bitrate?
skvlad
2016/04/05 23:21:27
The C++ equivalent will be replaced with rtc::Opti
|
| + self.maxBitrateBps = |
|
tkchin_webrtc
2016/04/05 18:48:15
ditto _maxBitrateBps = nativeParameters.max_bitrat
skvlad
2016/04/05 23:21:27
Done.
|
| + [NSNumber numberWithInt:nativeParameters.max_bitrate_bps]; |
| + } else { |
| + self.maxBitrateBps = nil; |
| + } |
| + self.active = nativeParameters.active; |
| + } |
| + return self; |
| +} |
| + |
| +@end |