Add the network preference to RTCConfiguration.

The network preference is added to RTCConfiguration and passed to ICE.
ICE considers now the preference set by applications over network
interface types when making decisions in candidate pair switching.

Bug: webrtc:8816
Change-Id: I40d2612705b54c83dd45772ac855808e0a76b1e1
Reviewed-on: https://webrtc-review.googlesource.com/44020
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21855}
This commit is contained in:
Qingsi Wang
2018-02-01 10:38:40 -08:00
committed by Commit Bot
parent dc221515ff
commit 9a5c6f8f3f
11 changed files with 154 additions and 22 deletions

View File

@ -304,6 +304,16 @@ public class PeerConnection {
/** Java version of PeerConnectionInterface.CandidateNetworkPolicy */
public enum CandidateNetworkPolicy { ALL, LOW_COST }
// Keep in sync with webrtc/rtc_base/network_constants.h.
public enum AdapterType {
UNKNOWN,
ETHERNET,
WIFI,
CELLULAR,
VPN,
LOOPBACK,
}
/** Java version of rtc::KeyType */
public enum KeyType { RSA, ECDSA }
@ -368,6 +378,9 @@ public class PeerConnection {
public Integer screencastMinBitrate;
public Boolean combinedAudioVideoBwe;
public Boolean enableDtlsSrtp;
// Use "Unknown" to represent no preference of adapter types, not the
// preference of adapters of unknown types.
public AdapterType networkPreference;
// This is an optional wrapper for the C++ webrtc::TurnCustomizer.
public TurnCustomizer turnCustomizer;
@ -403,6 +416,7 @@ public class PeerConnection {
screencastMinBitrate = null;
combinedAudioVideoBwe = null;
enableDtlsSrtp = null;
networkPreference = AdapterType.UNKNOWN;
}
@CalledByNative("RTCConfiguration")
@ -544,6 +558,11 @@ public class PeerConnection {
Boolean getEnableDtlsSrtp() {
return enableDtlsSrtp;
}
@CalledByNative("RTCConfiguration")
AdapterType getNetworkPreference() {
return networkPreference;
}
};
private final List<MediaStream> localStreams = new ArrayList<>();