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;
|
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
|
|
|
}
|
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) {
|
2017-02-04 12:09:01 -08:00
|
|
|
parameters.max_bitrate_bps = rtc::Optional<int>(_maxBitrateBps.intValue);
|
2016-04-08 17:28:55 -07:00
|
|
|
}
|
2017-01-06 16:53:00 -08:00
|
|
|
if (_ssrc != nil) {
|
|
|
|
|
parameters.ssrc = rtc::Optional<uint32_t>(_ssrc.unsignedLongValue);
|
|
|
|
|
}
|
2016-04-08 17:28:55 -07:00
|
|
|
return parameters;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|