2016-04-08 17:28:55 -07:00
|
|
|
/*
|
|
|
|
|
* 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;
|
2018-06-05 10:55:56 +02:00
|
|
|
@synthesize minBitrateBps = _minBitrateBps;
|
2018-09-27 09:53:11 +02:00
|
|
|
@synthesize maxFramerate = _maxFramerate;
|
2017-01-06 16:53:00 -08:00
|
|
|
@synthesize ssrc = _ssrc;
|
2016-04-08 17:28:55 -07:00
|
|
|
|
|
|
|
|
- (instancetype)init {
|
|
|
|
|
return [super init];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (instancetype)initWithNativeParameters:
|
|
|
|
|
(const webrtc::RtpEncodingParameters &)nativeParameters {
|
|
|
|
|
if (self = [self init]) {
|
|
|
|
|
_isActive = nativeParameters.active;
|
2017-02-04 12:09:01 -08:00
|
|
|
if (nativeParameters.max_bitrate_bps) {
|
2016-04-08 17:28:55 -07:00
|
|
|
_maxBitrateBps =
|
2017-02-04 12:09:01 -08:00
|
|
|
[NSNumber numberWithInt:*nativeParameters.max_bitrate_bps];
|
2016-04-08 17:28:55 -07:00
|
|
|
}
|
2018-06-05 10:55:56 +02:00
|
|
|
if (nativeParameters.min_bitrate_bps) {
|
|
|
|
|
_minBitrateBps =
|
|
|
|
|
[NSNumber numberWithInt:*nativeParameters.min_bitrate_bps];
|
|
|
|
|
}
|
2018-09-27 09:53:11 +02:00
|
|
|
if (nativeParameters.max_framerate) {
|
|
|
|
|
_maxFramerate = [NSNumber numberWithInt:*nativeParameters.max_framerate];
|
|
|
|
|
}
|
2017-01-06 16:53:00 -08:00
|
|
|
if (nativeParameters.ssrc) {
|
|
|
|
|
_ssrc = [NSNumber numberWithUnsignedLong:*nativeParameters.ssrc];
|
|
|
|
|
}
|
2016-04-08 17:28:55 -07:00
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (webrtc::RtpEncodingParameters)nativeParameters {
|
|
|
|
|
webrtc::RtpEncodingParameters parameters;
|
|
|
|
|
parameters.active = _isActive;
|
|
|
|
|
if (_maxBitrateBps != nil) {
|
2018-06-21 10:17:24 +02:00
|
|
|
parameters.max_bitrate_bps = absl::optional<int>(_maxBitrateBps.intValue);
|
2016-04-08 17:28:55 -07:00
|
|
|
}
|
2018-06-05 10:55:56 +02:00
|
|
|
if (_minBitrateBps != nil) {
|
2018-06-21 10:17:24 +02:00
|
|
|
parameters.min_bitrate_bps = absl::optional<int>(_minBitrateBps.intValue);
|
2018-06-05 10:55:56 +02:00
|
|
|
}
|
2018-09-27 09:53:11 +02:00
|
|
|
if (_maxFramerate != nil) {
|
|
|
|
|
parameters.max_framerate = absl::optional<int>(_maxFramerate.intValue);
|
|
|
|
|
}
|
2017-01-06 16:53:00 -08:00
|
|
|
if (_ssrc != nil) {
|
2018-06-21 10:17:24 +02:00
|
|
|
parameters.ssrc = absl::optional<uint32_t>(_ssrc.unsignedLongValue);
|
2017-01-06 16:53:00 -08:00
|
|
|
}
|
2016-04-08 17:28:55 -07:00
|
|
|
return parameters;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|