Objective-C API to set the ICE check rate through RTCConfiguration.

This is the Objective-C counterpart to
https://codereview.webrtc.org/2670053002/. Allows applications to
control the maximum ICE check rate to match bandwidth constraints.

BUG=webrtc:7082

Review-Url: https://codereview.webrtc.org/2674663002
Cr-Commit-Position: refs/heads/master@{#16423}
This commit is contained in:
skvlad
2017-02-02 13:02:30 -08:00
committed by Commit bot
parent b55bd5fef0
commit a5d94fff99
2 changed files with 17 additions and 2 deletions

View File

@ -37,6 +37,7 @@
@synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts;
@synthesize shouldPresumeWritableWhenFullyRelayed =
_shouldPresumeWritableWhenFullyRelayed;
@synthesize iceCheckMinInterval = _iceCheckMinInterval;
- (instancetype)init {
if (self = [super init]) {
@ -68,13 +69,17 @@
_shouldPruneTurnPorts = config.prune_turn_ports;
_shouldPresumeWritableWhenFullyRelayed =
config.presume_writable_when_fully_relayed;
if (config.ice_check_min_interval) {
_iceCheckMinInterval =
[NSNumber numberWithInt:*config.ice_check_min_interval];
}
}
return self;
}
- (NSString *)description {
return [NSString stringWithFormat:
@"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n}\n",
@"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%@\n}\n",
_iceServers,
[[self class] stringForTransportPolicy:_iceTransportPolicy],
[[self class] stringForBundlePolicy:_bundlePolicy],
@ -89,7 +94,8 @@
_iceBackupCandidatePairPingInterval,
_iceCandidatePoolSize,
_shouldPruneTurnPorts,
_shouldPresumeWritableWhenFullyRelayed];
_shouldPresumeWritableWhenFullyRelayed,
_iceCheckMinInterval];
}
#pragma mark - Private
@ -139,6 +145,10 @@
nativeConfig->prune_turn_ports = _shouldPruneTurnPorts ? true : false;
nativeConfig->presume_writable_when_fully_relayed =
_shouldPresumeWritableWhenFullyRelayed ? true : false;
if (_iceCheckMinInterval != nil) {
nativeConfig->ice_check_min_interval =
rtc::Optional<int>(_iceCheckMinInterval.intValue);
}
return nativeConfig.release();
}

View File

@ -104,6 +104,11 @@ RTC_EXPORT
*/
@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
/** If set to non-nil, controls the minimal interval between consecutive ICE
* check packets.
*/
@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
@end