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

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

Issue 3012843002: android: add IceServer.urls field (Closed)
Patch Set: jstring -> jobject 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
« no previous file with comments | « no previous file | webrtc/sdk/android/src/jni/pc/java_native_conversion.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
129 } 130 }
130 131
131 @Deprecated 132 @Deprecated
132 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) { 133 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) {
133 this(uri, username, password, tlsCertPolicy, ""); 134 this(uri, username, password, tlsCertPolicy, "");
134 } 135 }
135 136
136 @Deprecated 137 @Deprecated
137 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy, 138 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy,
138 String hostname) { 139 String hostname) {
139 this(uri, username, password, tlsCertPolicy, hostname, null, null); 140 this(uri, Collections.singletonList(uri), username, password, tlsCertPolic y, hostname, null,
141 null);
140 } 142 }
141 143
142 private IceServer(String uri, String username, String password, TlsCertPolic y tlsCertPolicy, 144 private IceServer(String uri, List<String> urls, String username, String pas sword,
143 String hostname, List<String> tlsAlpnProtocols, List<String> tlsElliptic Curves) { 145 TlsCertPolicy tlsCertPolicy, String hostname, List<String> tlsAlpnProtoc ols,
146 List<String> tlsEllipticCurves) {
147 if (uri == null || urls == null || urls.isEmpty()) {
148 throw new IllegalArgumentException("uri == null || urls == null || urls. isEmpty()");
149 }
150 for (String it : urls) {
151 if (it == null) {
152 throw new IllegalArgumentException("urls element is null: " + urls);
153 }
154 }
155 if (username == null) {
156 throw new IllegalArgumentException("username == null");
157 }
158 if (password == null) {
159 throw new IllegalArgumentException("password == null");
160 }
161 if (hostname == null) {
162 throw new IllegalArgumentException("hostname == null");
163 }
144 this.uri = uri; 164 this.uri = uri;
165 this.urls = urls;
145 this.username = username; 166 this.username = username;
146 this.password = password; 167 this.password = password;
147 this.tlsCertPolicy = tlsCertPolicy; 168 this.tlsCertPolicy = tlsCertPolicy;
148 this.hostname = hostname; 169 this.hostname = hostname;
149 this.tlsAlpnProtocols = tlsAlpnProtocols; 170 this.tlsAlpnProtocols = tlsAlpnProtocols;
150 this.tlsEllipticCurves = tlsEllipticCurves; 171 this.tlsEllipticCurves = tlsEllipticCurves;
151 } 172 }
152 173
153 public String toString() { 174 public String toString() {
154 return uri + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname 175 return urls + " [" + username + ":" + password + "] [" + tlsCertPolicy + " ] [" + hostname
155 + "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]"; 176 + "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]";
156 } 177 }
157 178
158 public static Builder builder(String uri) { 179 public static Builder builder(String uri) {
159 return new Builder(uri); 180 return new Builder(Collections.singletonList(uri));
181 }
182
183 public static Builder builder(List<String> urls) {
184 return new Builder(urls);
160 } 185 }
161 186
162 public static class Builder { 187 public static class Builder {
163 private String uri; 188 private final List<String> urls;
164 private String username = ""; 189 private String username = "";
165 private String password = ""; 190 private String password = "";
166 private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE ; 191 private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE ;
167 private String hostname = ""; 192 private String hostname = "";
168 private List<String> tlsAlpnProtocols; 193 private List<String> tlsAlpnProtocols;
169 private List<String> tlsEllipticCurves; 194 private List<String> tlsEllipticCurves;
170 195
171 private Builder(String uri) { 196 private Builder(List<String> urls) {
172 this.uri = uri; 197 if (urls == null || urls.isEmpty()) {
198 throw new IllegalArgumentException("urls == null || urls.isEmpty(): " + urls);
199 }
200 this.urls = urls;
173 } 201 }
174 202
175 public Builder setUsername(String username) { 203 public Builder setUsername(String username) {
176 this.username = username; 204 this.username = username;
177 return this; 205 return this;
178 } 206 }
179 207
180 public Builder setPassword(String password) { 208 public Builder setPassword(String password) {
181 this.password = password; 209 this.password = password;
182 return this; 210 return this;
(...skipping 13 matching lines...) Expand all
196 this.tlsAlpnProtocols = tlsAlpnProtocols; 224 this.tlsAlpnProtocols = tlsAlpnProtocols;
197 return this; 225 return this;
198 } 226 }
199 227
200 public Builder setTlsEllipticCurves(List<String> tlsEllipticCurves) { 228 public Builder setTlsEllipticCurves(List<String> tlsEllipticCurves) {
201 this.tlsEllipticCurves = tlsEllipticCurves; 229 this.tlsEllipticCurves = tlsEllipticCurves;
202 return this; 230 return this;
203 } 231 }
204 232
205 public IceServer createIceServer() { 233 public IceServer createIceServer() {
206 return new IceServer( 234 return new IceServer(urls.get(0), urls, username, password, tlsCertPolic y, hostname,
207 uri, username, password, tlsCertPolicy, hostname, tlsAlpnProtocols, tlsEllipticCurves); 235 tlsAlpnProtocols, tlsEllipticCurves);
208 } 236 }
209 } 237 }
210 } 238 }
211 239
212 /** Java version of PeerConnectionInterface.IceTransportsType */ 240 /** Java version of PeerConnectionInterface.IceTransportsType */
213 public enum IceTransportsType { NONE, RELAY, NOHOST, ALL } 241 public enum IceTransportsType { NONE, RELAY, NOHOST, ALL }
214 242
215 /** Java version of PeerConnectionInterface.BundlePolicy */ 243 /** Java version of PeerConnectionInterface.BundlePolicy */
216 public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT } 244 public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT }
217 245
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 private native RtpSender nativeCreateSender(String kind, String stream_id); 528 private native RtpSender nativeCreateSender(String kind, String stream_id);
501 529
502 private native List<RtpSender> nativeGetSenders(); 530 private native List<RtpSender> nativeGetSenders();
503 531
504 private native List<RtpReceiver> nativeGetReceivers(); 532 private native List<RtpReceiver> nativeGetReceivers();
505 533
506 private native boolean nativeStartRtcEventLog(int file_descriptor, int max_siz e_bytes); 534 private native boolean nativeStartRtcEventLog(int file_descriptor, int max_siz e_bytes);
507 535
508 private native void nativeStopRtcEventLog(); 536 private native void nativeStopRtcEventLog();
509 } 537 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/sdk/android/src/jni/pc/java_native_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698