Chromium Code Reviews| Index: webrtc/sdk/android/api/org/webrtc/PeerConnection.java |
| diff --git a/webrtc/sdk/android/api/org/webrtc/PeerConnection.java b/webrtc/sdk/android/api/org/webrtc/PeerConnection.java |
| index 832241097406e06e0c1f97c65a86fabf7f7f23c5..02f9a8989ede26faa2d1a4cd3cba8d198cc2021f 100644 |
| --- a/webrtc/sdk/android/api/org/webrtc/PeerConnection.java |
| +++ b/webrtc/sdk/android/api/org/webrtc/PeerConnection.java |
| @@ -99,7 +99,8 @@ public class PeerConnection { |
| // List of URIs associated with this server. Valid formats are described |
| // in RFC7064 and RFC7065, and more may be added in the future. The "host" |
| // part of the URI may contain either an IP address or a hostname. |
| - public final String uri; |
| + @Deprecated public final String uri; |
| + public final List<String> urls; |
| public final String username; |
| public final String password; |
| public final TlsCertPolicy tlsCertPolicy; |
| @@ -132,12 +133,16 @@ public class PeerConnection { |
| @Deprecated |
| public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy, |
| String hostname) { |
| - this(uri, username, password, tlsCertPolicy, hostname, null); |
| + this(uri, null, username, password, tlsCertPolicy, hostname, null); |
|
sakal
2017/09/07 07:46:36
Collections.singletonList(uri) instead of null
korniltsev
2017/09/07 20:33:46
Done.
|
| } |
| - private IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy, |
| - String hostname, List<String> tlsAlpnProtocols) { |
| + private IceServer(String uri, List<String> urls, String username, String password, |
| + TlsCertPolicy tlsCertPolicy, String hostname, List<String> tlsAlpnProtocols) { |
| + if (uri == null && urls == null) { |
|
sakal
2017/09/07 07:46:36
I don't think either of them should be null, use |
korniltsev
2017/09/07 20:33:46
Done. Also added urls.isEmpty() check. Also checke
|
| + throw new NullPointerException("uri == null && urls == null"); |
|
sakal
2017/09/07 07:46:36
IllegalArgumentException instead of NullPointerExc
korniltsev
2017/09/07 20:33:46
Done.
|
| + } |
| this.uri = uri; |
| + this.urls = urls; |
| this.username = username; |
| this.password = password; |
| this.tlsCertPolicy = tlsCertPolicy; |
| @@ -146,24 +151,29 @@ public class PeerConnection { |
| } |
| public String toString() { |
| - return uri + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname |
| - + "] [" + tlsAlpnProtocols + "]"; |
| + return uri != null ? uri |
|
sakal
2017/09/07 07:46:36
Ignore uri here and just print urls. Ensure that L
korniltsev
2017/09/07 20:33:46
Not quite sure about the second part. I know Array
sakal
2017/09/08 08:22:54
It's enough as long as this works in practice with
|
| + : urls + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" |
| + + hostname + "] [" + tlsAlpnProtocols + "]"; |
| } |
| public static Builder builder(String uri) { |
| - return new Builder(uri); |
| + return new Builder(Collections.singletonList(uri)); |
| + } |
| + |
| + public static Builder builder(List<String> urls) { |
| + return new Builder(urls); |
|
sakal
2017/09/07 07:46:36
Throw IllegalArgumentException if urls doesn't con
korniltsev
2017/09/07 20:33:46
The check is inside IceServer's constructor. Shoul
sakal
2017/09/08 08:22:54
urls.isEmpty will throw a null pointer exception n
|
| } |
| public static class Builder { |
| - private String uri; |
| + private final List<String> urls; |
| private String username = ""; |
| private String password = ""; |
| private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE; |
| private String hostname = ""; |
| private List<String> tlsAlpnProtocols; |
| - private Builder(String uri) { |
| - this.uri = uri; |
| + private Builder(List<String> urls) { |
| + this.urls = urls; |
| } |
| public Builder setUsername(String username) { |
| @@ -192,7 +202,8 @@ public class PeerConnection { |
| } |
| public IceServer createIceServer() { |
| - return new IceServer(uri, username, password, tlsCertPolicy, hostname, tlsAlpnProtocols); |
| + return new IceServer( |
| + null, urls, username, password, tlsCertPolicy, hostname, tlsAlpnProtocols); |
|
sakal
2017/09/07 07:46:36
Pass in urls.get(0) instead of null.
korniltsev
2017/09/07 20:33:46
Done.
|
| } |
| } |
| } |