Add a turn port prune policy to keep the first ready turn port.

Bug: webrtc:11026
Change-Id: I6222e9613ee4ce2dcfbb717e2430ea833c0dc373
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155542
Commit-Queue: Honghai Zhang <honghaiz@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29470}
This commit is contained in:
Honghai Zhang
2019-10-14 11:27:50 -07:00
committed by Commit Bot
parent ef98ae6bbb
commit f8998cf8c4
19 changed files with 257 additions and 81 deletions

View File

@ -407,6 +407,13 @@ public class PeerConnection {
/** Java version of PeerConnectionInterface.ContinualGatheringPolicy */
public enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY }
/** Java version of webrtc::PortPrunePolicy */
public enum PortPrunePolicy {
NO_PRUNE, // Do not prune turn port.
PRUNE_BASED_ON_PRIORITY, // Prune turn port based the priority on the same network
KEEP_FIRST_READY // Keep the first ready port and prune the rest on the same network.
}
/** Java version of rtc::IntervalRange */
public static class IntervalRange {
private final int min;
@ -472,7 +479,9 @@ public class PeerConnection {
public KeyType keyType;
public ContinualGatheringPolicy continualGatheringPolicy;
public int iceCandidatePoolSize;
@Deprecated // by the turnPortPrunePolicy. See bugs.webrtc.org/11026
public boolean pruneTurnPorts;
public PortPrunePolicy turnPortPrunePolicy;
public boolean presumeWritableWhenFullyRelayed;
public boolean surfaceIceCandidatesOnIceTransportTypeChanged;
// The following fields define intervals in milliseconds at which ICE
@ -583,6 +592,7 @@ public class PeerConnection {
continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE;
iceCandidatePoolSize = 0;
pruneTurnPorts = false;
turnPortPrunePolicy = PortPrunePolicy.NO_PRUNE;
presumeWritableWhenFullyRelayed = false;
surfaceIceCandidatesOnIceTransportTypeChanged = false;
iceCheckIntervalStrongConnectivityMs = null;
@ -626,6 +636,11 @@ public class PeerConnection {
return bundlePolicy;
}
@CalledByNative("RTCConfiguration")
PortPrunePolicy getTurnPortPrunePolicy() {
return turnPortPrunePolicy;
}
@Nullable
@CalledByNative("RTCConfiguration")
RtcCertificatePem getCertificate() {