Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1635)

Side by Side Diff: webrtc/sdk/android/api/org/webrtc/PeerConnection.java

Issue 3012843002: android: add IceServer.urls field (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * setRemoteDescription. 92 * setRemoteDescription.
93 */ 93 */
94 public void onAddTrack(RtpReceiver receiver, MediaStream[] mediaStreams); 94 public void onAddTrack(RtpReceiver receiver, MediaStream[] mediaStreams);
95 } 95 }
96 96
97 /** Java version of PeerConnectionInterface.IceServer. */ 97 /** Java version of PeerConnectionInterface.IceServer. */
98 public static class IceServer { 98 public static class IceServer {
99 // List of URIs associated with this server. Valid formats are described 99 // List of URIs associated with this server. Valid formats are described
100 // in RFC7064 and RFC7065, and more may be added in the future. The "host" 100 // in RFC7064 and RFC7065, and more may be added in the future. The "host"
101 // part of the URI may contain either an IP address or a hostname. 101 // part of the URI may contain either an IP address or a hostname.
102 public final String uri; 102 @Deprecated public final String uri;
103 public final List<String> urls;
103 public final String username; 104 public final String username;
104 public final String password; 105 public final String password;
105 public final TlsCertPolicy tlsCertPolicy; 106 public final TlsCertPolicy tlsCertPolicy;
106 107
107 // If the URIs in |urls| only contain IP addresses, this field can be used 108 // If the URIs in |urls| only contain IP addresses, this field can be used
108 // to indicate the hostname, which may be necessary for TLS (using the SNI 109 // to indicate the hostname, which may be necessary for TLS (using the SNI
109 // extension). If |urls| itself contains the hostname, this isn't 110 // extension). If |urls| itself contains the hostname, this isn't
110 // necessary. 111 // necessary.
111 public final String hostname; 112 public final String hostname;
112 113
(...skipping 12 matching lines...) Expand all
125 } 126 }
126 127
127 @Deprecated 128 @Deprecated
128 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) { 129 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) {
129 this(uri, username, password, tlsCertPolicy, ""); 130 this(uri, username, password, tlsCertPolicy, "");
130 } 131 }
131 132
132 @Deprecated 133 @Deprecated
133 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy, 134 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy,
134 String hostname) { 135 String hostname) {
135 this(uri, username, password, tlsCertPolicy, hostname, null); 136 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.
136 } 137 }
137 138
138 private IceServer(String uri, String username, String password, TlsCertPolic y tlsCertPolicy, 139 private IceServer(String uri, List<String> urls, String username, String pas sword,
139 String hostname, List<String> tlsAlpnProtocols) { 140 TlsCertPolicy tlsCertPolicy, String hostname, List<String> tlsAlpnProtoc ols) {
141 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
142 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.
143 }
140 this.uri = uri; 144 this.uri = uri;
145 this.urls = urls;
141 this.username = username; 146 this.username = username;
142 this.password = password; 147 this.password = password;
143 this.tlsCertPolicy = tlsCertPolicy; 148 this.tlsCertPolicy = tlsCertPolicy;
144 this.hostname = hostname; 149 this.hostname = hostname;
145 this.tlsAlpnProtocols = tlsAlpnProtocols; 150 this.tlsAlpnProtocols = tlsAlpnProtocols;
146 } 151 }
147 152
148 public String toString() { 153 public String toString() {
149 return uri + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname 154 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
150 + "] [" + tlsAlpnProtocols + "]"; 155 : urls + " [" + username + ":" + password + "] [" + tls CertPolicy + "] ["
156 + hostname + "] [" + tlsAlpnProtocols + "]";
151 } 157 }
152 158
153 public static Builder builder(String uri) { 159 public static Builder builder(String uri) {
154 return new Builder(uri); 160 return new Builder(Collections.singletonList(uri));
161 }
162
163 public static Builder builder(List<String> urls) {
164 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
155 } 165 }
156 166
157 public static class Builder { 167 public static class Builder {
158 private String uri; 168 private final List<String> urls;
159 private String username = ""; 169 private String username = "";
160 private String password = ""; 170 private String password = "";
161 private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE ; 171 private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE ;
162 private String hostname = ""; 172 private String hostname = "";
163 private List<String> tlsAlpnProtocols; 173 private List<String> tlsAlpnProtocols;
164 174
165 private Builder(String uri) { 175 private Builder(List<String> urls) {
166 this.uri = uri; 176 this.urls = urls;
167 } 177 }
168 178
169 public Builder setUsername(String username) { 179 public Builder setUsername(String username) {
170 this.username = username; 180 this.username = username;
171 return this; 181 return this;
172 } 182 }
173 183
174 public Builder setPassword(String password) { 184 public Builder setPassword(String password) {
175 this.password = password; 185 this.password = password;
176 return this; 186 return this;
177 } 187 }
178 188
179 public Builder setTlsCertPolicy(TlsCertPolicy tlsCertPolicy) { 189 public Builder setTlsCertPolicy(TlsCertPolicy tlsCertPolicy) {
180 this.tlsCertPolicy = tlsCertPolicy; 190 this.tlsCertPolicy = tlsCertPolicy;
181 return this; 191 return this;
182 } 192 }
183 193
184 public Builder setHostname(String hostname) { 194 public Builder setHostname(String hostname) {
185 this.hostname = hostname; 195 this.hostname = hostname;
186 return this; 196 return this;
187 } 197 }
188 198
189 public Builder setTlsAlpnProtocols(List<String> tlsAlpnProtocols) { 199 public Builder setTlsAlpnProtocols(List<String> tlsAlpnProtocols) {
190 this.tlsAlpnProtocols = tlsAlpnProtocols; 200 this.tlsAlpnProtocols = tlsAlpnProtocols;
191 return this; 201 return this;
192 } 202 }
193 203
194 public IceServer createIceServer() { 204 public IceServer createIceServer() {
195 return new IceServer(uri, username, password, tlsCertPolicy, hostname, t lsAlpnProtocols); 205 return new IceServer(
206 null, urls, username, password, tlsCertPolicy, hostname, tlsAlpnProt ocols);
sakal 2017/09/07 07:46:36 Pass in urls.get(0) instead of null.
korniltsev 2017/09/07 20:33:46 Done.
196 } 207 }
197 } 208 }
198 } 209 }
199 210
200 /** Java version of PeerConnectionInterface.IceTransportsType */ 211 /** Java version of PeerConnectionInterface.IceTransportsType */
201 public enum IceTransportsType { NONE, RELAY, NOHOST, ALL } 212 public enum IceTransportsType { NONE, RELAY, NOHOST, ALL }
202 213
203 /** Java version of PeerConnectionInterface.BundlePolicy */ 214 /** Java version of PeerConnectionInterface.BundlePolicy */
204 public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT } 215 public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT }
205 216
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 private native RtpSender nativeCreateSender(String kind, String stream_id); 499 private native RtpSender nativeCreateSender(String kind, String stream_id);
489 500
490 private native List<RtpSender> nativeGetSenders(); 501 private native List<RtpSender> nativeGetSenders();
491 502
492 private native List<RtpReceiver> nativeGetReceivers(); 503 private native List<RtpReceiver> nativeGetReceivers();
493 504
494 private native boolean nativeStartRtcEventLog(int file_descriptor, int max_siz e_bytes); 505 private native boolean nativeStartRtcEventLog(int file_descriptor, int max_siz e_bytes);
495 506
496 private native void nativeStopRtcEventLog(); 507 private native void nativeStopRtcEventLog();
497 } 508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698