Adding API for "presume writable when fully relayed" ICE option.

For explanation of what this is, see:
https://codereview.webrtc.org/2063823008/

R=glaznev@webrtc.org, pthatcher@webrtc.org
TBR=tkchin@webrtc.org

Review URL: https://codereview.webrtc.org/2107303003 .

Cr-Commit-Position: refs/heads/master@{#13366}
This commit is contained in:
Taylor Brandstetter 2016-07-01 11:11:13 -07:00
parent fe3654d5dc
commit e9851116e2
6 changed files with 24 additions and 2 deletions

View File

@ -146,6 +146,7 @@ public class PeerConnection {
public KeyType keyType;
public ContinualGatheringPolicy continualGatheringPolicy;
public int iceCandidatePoolSize;
public boolean presumeWritableWhenFullyRelayed;
public RTCConfiguration(List<IceServer> iceServers) {
iceTransportsType = IceTransportsType.ALL;
@ -161,6 +162,7 @@ public class PeerConnection {
keyType = KeyType.ECDSA;
continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE;
iceCandidatePoolSize = 0;
presumeWritableWhenFullyRelayed = false;
}
};

View File

@ -1589,6 +1589,8 @@ static void JavaRTCConfigurationToJsepRTCConfiguration(
jfieldID j_ice_candidate_pool_size_id =
GetFieldID(jni, j_rtc_config_class, "iceCandidatePoolSize", "I");
jfieldID j_presume_writable_when_fully_relayed_id = GetFieldID(
jni, j_rtc_config_class, "presumeWritableWhenFullyRelayed", "Z");
rtc_config->type =
JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type);
@ -1614,6 +1616,8 @@ static void JavaRTCConfigurationToJsepRTCConfiguration(
jni, j_continual_gathering_policy);
rtc_config->ice_candidate_pool_size =
GetIntField(jni, j_rtc_config, j_ice_candidate_pool_size_id);
rtc_config->presume_writable_when_fully_relayed = GetBooleanField(
jni, j_rtc_config, j_presume_writable_when_fully_relayed_id);
}
JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(

View File

@ -301,6 +301,9 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
rtc::Optional<bool> enable_dtls_srtp;
int ice_candidate_pool_size = 0;
bool prune_turn_ports = false;
// If set to true, this means the ICE transport should presume TURN-to-TURN
// candidate pairs will succeed, even before a binding response is received.
bool presume_writable_when_fully_relayed = false;
};
struct RTCOfferAnswerOptions {

View File

@ -1136,6 +1136,8 @@ cricket::IceConfig WebRtcSession::ParseIceConfig(
config.ice_backup_candidate_pair_ping_interval;
ice_config.gather_continually = (config.continual_gathering_policy ==
PeerConnectionInterface::GATHER_CONTINUALLY);
ice_config.presume_writable_when_fully_relayed =
config.presume_writable_when_fully_relayed;
return ice_config;
}

View File

@ -33,6 +33,7 @@
_iceBackupCandidatePairPingInterval;
@synthesize keyType = _keyType;
@synthesize iceCandidatePoolSize = _iceCandidatePoolSize;
@synthesize presumeWritableWhenFullyRelayed = _presumeWritableWhenFullyRelayed;
- (instancetype)init {
if (self = [super init]) {
@ -59,13 +60,15 @@
config.ice_backup_candidate_pair_ping_interval;
_keyType = RTCEncryptionKeyTypeECDSA;
_iceCandidatePoolSize = config.ice_candidate_pool_size;
_presumeWritableWhenFullyRelayed =
config.presume_writable_when_fully_relayed;
}
return self;
}
- (NSString *)description {
return [NSString stringWithFormat:
@"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\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}\n",
_iceServers,
[[self class] stringForTransportPolicy:_iceTransportPolicy],
[[self class] stringForBundlePolicy:_bundlePolicy],
@ -77,7 +80,8 @@
_audioJitterBufferMaxPackets,
_iceConnectionReceivingTimeout,
_iceBackupCandidatePairPingInterval,
_iceCandidatePoolSize];
_iceCandidatePoolSize,
_presumeWritableWhenFullyRelayed];
}
#pragma mark - Private
@ -121,6 +125,8 @@
nativeConfig->certificates.push_back(certificate);
}
nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize;
nativeConfig->presume_writable_when_fully_relayed =
_presumeWritableWhenFullyRelayed;
return nativeConfig.release();
}

View File

@ -93,6 +93,11 @@ RTC_EXPORT
/** ICE candidate pool size as defined in JSEP. Default is 0. */
@property(nonatomic, assign) int iceCandidatePoolSize;
/** If set to true, this means the ICE transport should presume TURN-to-TURN
* candidate pairs will succeed, even before a binding response is received.
*/
@property(nonatomic, assign) bool presumeWritableWhenFullyRelayed;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
@end