blob: de1e57d78780c5af456c59cbd0afdc8d8b3d407b [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
henrike@webrtc.org28e20752013-07-10 00:45:36 +000011package org.webrtc;
12
Magnus Jedvert6062f372017-11-16 16:53:12 +010013import java.util.ArrayList;
Sami Kalliomäki3e189a62017-11-24 11:13:39 +010014import java.util.Collections;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000015import java.util.List;
16
17/**
18 * Java-land version of the PeerConnection APIs; wraps the C++ API
19 * http://www.webrtc.org/reference/native-apis, which in turn is inspired by the
20 * JS APIs: http://dev.w3.org/2011/webrtc/editor/webrtc.html and
21 * http://www.w3.org/TR/mediacapture-streams/
22 */
Magnus Jedvert84d8ae52017-12-20 15:12:10 +010023@JNINamespace("webrtc::jni")
henrike@webrtc.org28e20752013-07-10 00:45:36 +000024public class PeerConnection {
henrike@webrtc.org28e20752013-07-10 00:45:36 +000025 /** Tracks PeerConnectionInterface::IceGatheringState */
Magnus Jedvertba700f62017-12-04 13:43:27 +010026 public enum IceGatheringState {
27 NEW,
28 GATHERING,
29 COMPLETE;
30
31 @CalledByNative("IceGatheringState")
32 static IceGatheringState fromNativeIndex(int nativeIndex) {
33 return values()[nativeIndex];
34 }
35 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +000036
37 /** Tracks PeerConnectionInterface::IceConnectionState */
38 public enum IceConnectionState {
sakalb6760f92016-09-29 04:12:44 -070039 NEW,
40 CHECKING,
41 CONNECTED,
42 COMPLETED,
43 FAILED,
44 DISCONNECTED,
Magnus Jedvertba700f62017-12-04 13:43:27 +010045 CLOSED;
46
47 @CalledByNative("IceConnectionState")
48 static IceConnectionState fromNativeIndex(int nativeIndex) {
49 return values()[nativeIndex];
50 }
sakalb6760f92016-09-29 04:12:44 -070051 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +000052
hnsl04833622017-01-09 08:35:45 -080053 /** Tracks PeerConnectionInterface::TlsCertPolicy */
54 public enum TlsCertPolicy {
55 TLS_CERT_POLICY_SECURE,
56 TLS_CERT_POLICY_INSECURE_NO_CHECK,
57 }
58
henrike@webrtc.org28e20752013-07-10 00:45:36 +000059 /** Tracks PeerConnectionInterface::SignalingState */
60 public enum SignalingState {
sakalb6760f92016-09-29 04:12:44 -070061 STABLE,
62 HAVE_LOCAL_OFFER,
63 HAVE_LOCAL_PRANSWER,
64 HAVE_REMOTE_OFFER,
65 HAVE_REMOTE_PRANSWER,
Magnus Jedvertba700f62017-12-04 13:43:27 +010066 CLOSED;
67
68 @CalledByNative("SignalingState")
69 static SignalingState fromNativeIndex(int nativeIndex) {
70 return values()[nativeIndex];
71 }
sakalb6760f92016-09-29 04:12:44 -070072 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +000073
74 /** Java version of PeerConnectionObserver. */
75 public static interface Observer {
76 /** Triggered when the SignalingState changes. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010077 @CalledByNative("Observer") void onSignalingChange(SignalingState newState);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000078
79 /** Triggered when the IceConnectionState changes. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010080 @CalledByNative("Observer") void onIceConnectionChange(IceConnectionState newState);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000081
Peter Thatcher54360512015-07-08 11:08:35 -070082 /** Triggered when the ICE connection receiving status changes. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010083 @CalledByNative("Observer") void onIceConnectionReceivingChange(boolean receiving);
Peter Thatcher54360512015-07-08 11:08:35 -070084
henrike@webrtc.org28e20752013-07-10 00:45:36 +000085 /** Triggered when the IceGatheringState changes. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010086 @CalledByNative("Observer") void onIceGatheringChange(IceGatheringState newState);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000087
88 /** Triggered when a new ICE candidate has been found. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010089 @CalledByNative("Observer") void onIceCandidate(IceCandidate candidate);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000090
Honghai Zhang7fb69db2016-03-14 11:59:18 -070091 /** Triggered when some ICE candidates have been removed. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010092 @CalledByNative("Observer") void onIceCandidatesRemoved(IceCandidate[] candidates);
Honghai Zhang7fb69db2016-03-14 11:59:18 -070093
henrike@webrtc.org28e20752013-07-10 00:45:36 +000094 /** Triggered when media is received on a new stream from remote peer. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010095 @CalledByNative("Observer") void onAddStream(MediaStream stream);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000096
97 /** Triggered when a remote peer close a stream. */
Magnus Jedvertba700f62017-12-04 13:43:27 +010098 @CalledByNative("Observer") void onRemoveStream(MediaStream stream);
henrike@webrtc.org723d6832013-07-12 16:04:50 +000099
100 /** Triggered when a remote peer opens a DataChannel. */
Magnus Jedvertba700f62017-12-04 13:43:27 +0100101 @CalledByNative("Observer") void onDataChannel(DataChannel dataChannel);
fischman@webrtc.orgd7568a02014-01-13 22:04:12 +0000102
103 /** Triggered when renegotiation is necessary. */
Magnus Jedvertba700f62017-12-04 13:43:27 +0100104 @CalledByNative("Observer") void onRenegotiationNeeded();
zhihuangdcccda72016-12-21 14:08:03 -0800105
106 /**
107 * Triggered when a new track is signaled by the remote peer, as a result of
108 * setRemoteDescription.
109 */
Magnus Jedvertba700f62017-12-04 13:43:27 +0100110 @CalledByNative("Observer") void onAddTrack(RtpReceiver receiver, MediaStream[] mediaStreams);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000111 }
112
113 /** Java version of PeerConnectionInterface.IceServer. */
114 public static class IceServer {
Emad Omaradab1d2d2017-06-16 15:43:11 -0700115 // List of URIs associated with this server. Valid formats are described
116 // in RFC7064 and RFC7065, and more may be added in the future. The "host"
117 // part of the URI may contain either an IP address or a hostname.
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700118 @Deprecated public final String uri;
119 public final List<String> urls;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120 public final String username;
121 public final String password;
hnsl04833622017-01-09 08:35:45 -0800122 public final TlsCertPolicy tlsCertPolicy;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000123
Emad Omaradab1d2d2017-06-16 15:43:11 -0700124 // If the URIs in |urls| only contain IP addresses, this field can be used
125 // to indicate the hostname, which may be necessary for TLS (using the SNI
126 // extension). If |urls| itself contains the hostname, this isn't
127 // necessary.
128 public final String hostname;
129
Diogo Real1dca9d52017-08-29 12:18:32 -0700130 // List of protocols to be used in the TLS ALPN extension.
131 public final List<String> tlsAlpnProtocols;
132
Diogo Real7bd1f1b2017-09-08 12:50:41 -0700133 // List of elliptic curves to be used in the TLS elliptic curves extension.
134 // Only curve names supported by OpenSSL should be used (eg. "P-256","X25519").
135 public final List<String> tlsEllipticCurves;
136
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000137 /** Convenience constructor for STUN servers. */
Diogo Real05ea2b32017-08-31 00:12:58 -0700138 @Deprecated
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000139 public IceServer(String uri) {
140 this(uri, "", "");
141 }
142
Diogo Real05ea2b32017-08-31 00:12:58 -0700143 @Deprecated
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000144 public IceServer(String uri, String username, String password) {
hnsl04833622017-01-09 08:35:45 -0800145 this(uri, username, password, TlsCertPolicy.TLS_CERT_POLICY_SECURE);
146 }
147
Diogo Real05ea2b32017-08-31 00:12:58 -0700148 @Deprecated
hnsl04833622017-01-09 08:35:45 -0800149 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) {
Emad Omaradab1d2d2017-06-16 15:43:11 -0700150 this(uri, username, password, tlsCertPolicy, "");
151 }
152
Diogo Real05ea2b32017-08-31 00:12:58 -0700153 @Deprecated
Emad Omaradab1d2d2017-06-16 15:43:11 -0700154 public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy,
155 String hostname) {
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700156 this(uri, Collections.singletonList(uri), username, password, tlsCertPolicy, hostname, null,
157 null);
Diogo Real1dca9d52017-08-29 12:18:32 -0700158 }
159
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700160 private IceServer(String uri, List<String> urls, String username, String password,
161 TlsCertPolicy tlsCertPolicy, String hostname, List<String> tlsAlpnProtocols,
162 List<String> tlsEllipticCurves) {
163 if (uri == null || urls == null || urls.isEmpty()) {
164 throw new IllegalArgumentException("uri == null || urls == null || urls.isEmpty()");
165 }
166 for (String it : urls) {
167 if (it == null) {
168 throw new IllegalArgumentException("urls element is null: " + urls);
169 }
170 }
171 if (username == null) {
172 throw new IllegalArgumentException("username == null");
173 }
174 if (password == null) {
175 throw new IllegalArgumentException("password == null");
176 }
177 if (hostname == null) {
178 throw new IllegalArgumentException("hostname == null");
179 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000180 this.uri = uri;
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700181 this.urls = urls;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000182 this.username = username;
183 this.password = password;
hnsl04833622017-01-09 08:35:45 -0800184 this.tlsCertPolicy = tlsCertPolicy;
Emad Omaradab1d2d2017-06-16 15:43:11 -0700185 this.hostname = hostname;
Diogo Real1dca9d52017-08-29 12:18:32 -0700186 this.tlsAlpnProtocols = tlsAlpnProtocols;
Diogo Real7bd1f1b2017-09-08 12:50:41 -0700187 this.tlsEllipticCurves = tlsEllipticCurves;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000188 }
189
Sami Kalliomäkibde473e2017-10-30 13:34:41 +0100190 @Override
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000191 public String toString() {
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700192 return urls + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname
Diogo Real7bd1f1b2017-09-08 12:50:41 -0700193 + "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]";
Diogo Real1dca9d52017-08-29 12:18:32 -0700194 }
195
196 public static Builder builder(String uri) {
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700197 return new Builder(Collections.singletonList(uri));
198 }
199
200 public static Builder builder(List<String> urls) {
201 return new Builder(urls);
Diogo Real1dca9d52017-08-29 12:18:32 -0700202 }
203
204 public static class Builder {
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700205 private final List<String> urls;
Diogo Real1dca9d52017-08-29 12:18:32 -0700206 private String username = "";
207 private String password = "";
208 private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE;
209 private String hostname = "";
210 private List<String> tlsAlpnProtocols;
Diogo Real7bd1f1b2017-09-08 12:50:41 -0700211 private List<String> tlsEllipticCurves;
Diogo Real1dca9d52017-08-29 12:18:32 -0700212
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700213 private Builder(List<String> urls) {
214 if (urls == null || urls.isEmpty()) {
215 throw new IllegalArgumentException("urls == null || urls.isEmpty(): " + urls);
216 }
217 this.urls = urls;
Diogo Real1dca9d52017-08-29 12:18:32 -0700218 }
219
220 public Builder setUsername(String username) {
221 this.username = username;
222 return this;
223 }
224
225 public Builder setPassword(String password) {
226 this.password = password;
227 return this;
228 }
229
230 public Builder setTlsCertPolicy(TlsCertPolicy tlsCertPolicy) {
231 this.tlsCertPolicy = tlsCertPolicy;
232 return this;
233 }
234
235 public Builder setHostname(String hostname) {
236 this.hostname = hostname;
237 return this;
238 }
239
240 public Builder setTlsAlpnProtocols(List<String> tlsAlpnProtocols) {
241 this.tlsAlpnProtocols = tlsAlpnProtocols;
242 return this;
243 }
244
Diogo Real7bd1f1b2017-09-08 12:50:41 -0700245 public Builder setTlsEllipticCurves(List<String> tlsEllipticCurves) {
246 this.tlsEllipticCurves = tlsEllipticCurves;
247 return this;
248 }
249
Diogo Real1dca9d52017-08-29 12:18:32 -0700250 public IceServer createIceServer() {
korniltsev.anatoly0ea03102017-09-11 06:41:38 -0700251 return new IceServer(urls.get(0), urls, username, password, tlsCertPolicy, hostname,
252 tlsAlpnProtocols, tlsEllipticCurves);
Diogo Real1dca9d52017-08-29 12:18:32 -0700253 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000254 }
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100255
256 @CalledByNative("IceServer")
257 List<String> getUrls() {
258 return urls;
259 }
260
261 @CalledByNative("IceServer")
262 String getUsername() {
263 return username;
264 }
265
266 @CalledByNative("IceServer")
267 String getPassword() {
268 return password;
269 }
270
271 @CalledByNative("IceServer")
272 TlsCertPolicy getTlsCertPolicy() {
273 return tlsCertPolicy;
274 }
275
276 @CalledByNative("IceServer")
277 String getHostname() {
278 return hostname;
279 }
280
281 @CalledByNative("IceServer")
282 List<String> getTlsAlpnProtocols() {
283 return tlsAlpnProtocols;
284 }
285
286 @CalledByNative("IceServer")
287 List<String> getTlsEllipticCurves() {
288 return tlsEllipticCurves;
289 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000290 }
291
Jiayang Liucac1b382015-04-30 12:35:24 -0700292 /** Java version of PeerConnectionInterface.IceTransportsType */
sakalb6760f92016-09-29 04:12:44 -0700293 public enum IceTransportsType { NONE, RELAY, NOHOST, ALL }
Jiayang Liucac1b382015-04-30 12:35:24 -0700294
295 /** Java version of PeerConnectionInterface.BundlePolicy */
sakalb6760f92016-09-29 04:12:44 -0700296 public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT }
Jiayang Liucac1b382015-04-30 12:35:24 -0700297
Peter Thatcheraf55ccc2015-05-21 07:48:41 -0700298 /** Java version of PeerConnectionInterface.RtcpMuxPolicy */
sakalb6760f92016-09-29 04:12:44 -0700299 public enum RtcpMuxPolicy { NEGOTIATE, REQUIRE }
glaznev97579a42015-09-01 11:31:27 -0700300
Peter Thatcheraf55ccc2015-05-21 07:48:41 -0700301 /** Java version of PeerConnectionInterface.TcpCandidatePolicy */
sakalb6760f92016-09-29 04:12:44 -0700302 public enum TcpCandidatePolicy { ENABLED, DISABLED }
Jiayang Liucac1b382015-04-30 12:35:24 -0700303
honghaiz60347052016-05-31 18:29:12 -0700304 /** Java version of PeerConnectionInterface.CandidateNetworkPolicy */
sakalb6760f92016-09-29 04:12:44 -0700305 public enum CandidateNetworkPolicy { ALL, LOW_COST }
honghaiz60347052016-05-31 18:29:12 -0700306
Qingsi Wang9a5c6f82018-02-01 10:38:40 -0800307 // Keep in sync with webrtc/rtc_base/network_constants.h.
308 public enum AdapterType {
309 UNKNOWN,
310 ETHERNET,
311 WIFI,
312 CELLULAR,
313 VPN,
314 LOOPBACK,
315 }
316
glaznev97579a42015-09-01 11:31:27 -0700317 /** Java version of rtc::KeyType */
sakalb6760f92016-09-29 04:12:44 -0700318 public enum KeyType { RSA, ECDSA }
glaznev97579a42015-09-01 11:31:27 -0700319
honghaiz1f429e32015-09-28 07:57:34 -0700320 /** Java version of PeerConnectionInterface.ContinualGatheringPolicy */
sakalb6760f92016-09-29 04:12:44 -0700321 public enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY }
honghaiz1f429e32015-09-28 07:57:34 -0700322
Steve Antond960a0c2017-07-17 12:33:07 -0700323 /** Java version of rtc::IntervalRange */
324 public static class IntervalRange {
325 private final int min;
326 private final int max;
327
328 public IntervalRange(int min, int max) {
329 this.min = min;
330 this.max = max;
331 }
332
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100333 @CalledByNative("IntervalRange")
Steve Antond960a0c2017-07-17 12:33:07 -0700334 public int getMin() {
335 return min;
336 }
337
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100338 @CalledByNative("IntervalRange")
Steve Antond960a0c2017-07-17 12:33:07 -0700339 public int getMax() {
340 return max;
341 }
342 }
343
Jiayang Liucac1b382015-04-30 12:35:24 -0700344 /** Java version of PeerConnectionInterface.RTCConfiguration */
Qingsi Wangdb53f8e2018-02-20 14:45:49 -0800345 // TODO(qingsi): Resolve the naming inconsistency of fields with/without units.
Jiayang Liucac1b382015-04-30 12:35:24 -0700346 public static class RTCConfiguration {
347 public IceTransportsType iceTransportsType;
348 public List<IceServer> iceServers;
349 public BundlePolicy bundlePolicy;
Peter Thatcheraf55ccc2015-05-21 07:48:41 -0700350 public RtcpMuxPolicy rtcpMuxPolicy;
Jiayang Liucac1b382015-04-30 12:35:24 -0700351 public TcpCandidatePolicy tcpCandidatePolicy;
honghaiz60347052016-05-31 18:29:12 -0700352 public CandidateNetworkPolicy candidateNetworkPolicy;
Henrik Lundin64dad832015-05-11 12:44:23 +0200353 public int audioJitterBufferMaxPackets;
Henrik Lundin5263b3c2015-06-01 10:29:41 +0200354 public boolean audioJitterBufferFastAccelerate;
honghaiz4edc39c2015-09-01 09:53:56 -0700355 public int iceConnectionReceivingTimeout;
Honghai Zhang381b4212015-12-04 12:24:03 -0800356 public int iceBackupCandidatePairPingInterval;
glaznev97579a42015-09-01 11:31:27 -0700357 public KeyType keyType;
honghaiz1f429e32015-09-28 07:57:34 -0700358 public ContinualGatheringPolicy continualGatheringPolicy;
deadbeefbe0c96f2016-05-18 16:20:14 -0700359 public int iceCandidatePoolSize;
Honghai Zhangd78ecf72016-07-01 14:40:40 -0700360 public boolean pruneTurnPorts;
Taylor Brandstettere9851112016-07-01 11:11:13 -0700361 public boolean presumeWritableWhenFullyRelayed;
skvlad51072462017-02-02 11:50:14 -0800362 public Integer iceCheckMinInterval;
Qingsi Wangdb53f8e2018-02-20 14:45:49 -0800363 // The interval in milliseconds at which STUN candidates will resend STUN binding requests
364 // to keep NAT bindings open.
365 // The default value in the implementation is used if this field is null.
366 public Integer stunCandidateKeepaliveIntervalMs;
zhihuangb09b3f92017-03-07 14:40:51 -0800367 public boolean disableIPv6OnWifi;
deadbeef28e29192017-07-27 09:14:38 -0700368 // By default, PeerConnection will use a limited number of IPv6 network
369 // interfaces, in order to avoid too many ICE candidate pairs being created
370 // and delaying ICE completion.
371 //
372 // Can be set to Integer.MAX_VALUE to effectively disable the limit.
373 public int maxIPv6Networks;
Steve Antond960a0c2017-07-17 12:33:07 -0700374 public IntervalRange iceRegatherIntervalRange;
Jiayang Liucac1b382015-04-30 12:35:24 -0700375
Sami Kalliomäkie8b26cd2017-12-19 12:51:53 +0100376 // These values will be overridden by MediaStream constraints if deprecated constraints-based
377 // create peerconnection interface is used.
378 public boolean disableIpv6;
379 public boolean enableDscp;
380 public boolean enableCpuOveruseDetection;
381 public boolean enableRtpDataChannel;
382 public boolean suspendBelowMinBitrate;
383 public Integer screencastMinBitrate;
384 public Boolean combinedAudioVideoBwe;
385 public Boolean enableDtlsSrtp;
Qingsi Wang9a5c6f82018-02-01 10:38:40 -0800386 // Use "Unknown" to represent no preference of adapter types, not the
387 // preference of adapters of unknown types.
388 public AdapterType networkPreference;
Sami Kalliomäkie8b26cd2017-12-19 12:51:53 +0100389
Jonas Orelandbdcee282017-10-10 14:01:40 +0200390 // This is an optional wrapper for the C++ webrtc::TurnCustomizer.
391 public TurnCustomizer turnCustomizer;
392
deadbeef28e29192017-07-27 09:14:38 -0700393 // TODO(deadbeef): Instead of duplicating the defaults here, we should do
394 // something to pick up the defaults from C++. The Objective-C equivalent
395 // of RTCConfiguration does that.
Jiayang Liucac1b382015-04-30 12:35:24 -0700396 public RTCConfiguration(List<IceServer> iceServers) {
397 iceTransportsType = IceTransportsType.ALL;
398 bundlePolicy = BundlePolicy.BALANCED;
zhihuang4dfb8ce2016-11-23 10:30:12 -0800399 rtcpMuxPolicy = RtcpMuxPolicy.REQUIRE;
Jiayang Liucac1b382015-04-30 12:35:24 -0700400 tcpCandidatePolicy = TcpCandidatePolicy.ENABLED;
Sami Kalliomäki9828beb2017-10-26 16:21:22 +0200401 candidateNetworkPolicy = CandidateNetworkPolicy.ALL;
Jiayang Liucac1b382015-04-30 12:35:24 -0700402 this.iceServers = iceServers;
Henrik Lundin64dad832015-05-11 12:44:23 +0200403 audioJitterBufferMaxPackets = 50;
Henrik Lundin5263b3c2015-06-01 10:29:41 +0200404 audioJitterBufferFastAccelerate = false;
honghaiz4edc39c2015-09-01 09:53:56 -0700405 iceConnectionReceivingTimeout = -1;
Honghai Zhang381b4212015-12-04 12:24:03 -0800406 iceBackupCandidatePairPingInterval = -1;
glaznev97579a42015-09-01 11:31:27 -0700407 keyType = KeyType.ECDSA;
honghaiz1f429e32015-09-28 07:57:34 -0700408 continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE;
deadbeefbe0c96f2016-05-18 16:20:14 -0700409 iceCandidatePoolSize = 0;
Honghai Zhangd78ecf72016-07-01 14:40:40 -0700410 pruneTurnPorts = false;
Taylor Brandstettere9851112016-07-01 11:11:13 -0700411 presumeWritableWhenFullyRelayed = false;
skvlad51072462017-02-02 11:50:14 -0800412 iceCheckMinInterval = null;
Qingsi Wangdb53f8e2018-02-20 14:45:49 -0800413 stunCandidateKeepaliveIntervalMs = null;
zhihuangb09b3f92017-03-07 14:40:51 -0800414 disableIPv6OnWifi = false;
deadbeef28e29192017-07-27 09:14:38 -0700415 maxIPv6Networks = 5;
Steve Antond960a0c2017-07-17 12:33:07 -0700416 iceRegatherIntervalRange = null;
Sami Kalliomäkie8b26cd2017-12-19 12:51:53 +0100417 disableIpv6 = false;
418 enableDscp = false;
419 enableCpuOveruseDetection = true;
420 enableRtpDataChannel = false;
421 suspendBelowMinBitrate = false;
422 screencastMinBitrate = null;
423 combinedAudioVideoBwe = null;
424 enableDtlsSrtp = null;
Qingsi Wang9a5c6f82018-02-01 10:38:40 -0800425 networkPreference = AdapterType.UNKNOWN;
Jiayang Liucac1b382015-04-30 12:35:24 -0700426 }
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100427
428 @CalledByNative("RTCConfiguration")
429 IceTransportsType getIceTransportsType() {
430 return iceTransportsType;
431 }
432
433 @CalledByNative("RTCConfiguration")
434 List<IceServer> getIceServers() {
435 return iceServers;
436 }
437
438 @CalledByNative("RTCConfiguration")
439 BundlePolicy getBundlePolicy() {
440 return bundlePolicy;
441 }
442
443 @CalledByNative("RTCConfiguration")
444 RtcpMuxPolicy getRtcpMuxPolicy() {
445 return rtcpMuxPolicy;
446 }
447
448 @CalledByNative("RTCConfiguration")
449 TcpCandidatePolicy getTcpCandidatePolicy() {
450 return tcpCandidatePolicy;
451 }
452
453 @CalledByNative("RTCConfiguration")
454 CandidateNetworkPolicy getCandidateNetworkPolicy() {
455 return candidateNetworkPolicy;
456 }
457
458 @CalledByNative("RTCConfiguration")
459 int getAudioJitterBufferMaxPackets() {
460 return audioJitterBufferMaxPackets;
461 }
462
463 @CalledByNative("RTCConfiguration")
464 boolean getAudioJitterBufferFastAccelerate() {
465 return audioJitterBufferFastAccelerate;
466 }
467
468 @CalledByNative("RTCConfiguration")
469 int getIceConnectionReceivingTimeout() {
470 return iceConnectionReceivingTimeout;
471 }
472
473 @CalledByNative("RTCConfiguration")
474 int getIceBackupCandidatePairPingInterval() {
475 return iceBackupCandidatePairPingInterval;
476 }
477
478 @CalledByNative("RTCConfiguration")
479 KeyType getKeyType() {
480 return keyType;
481 }
482
483 @CalledByNative("RTCConfiguration")
484 ContinualGatheringPolicy getContinualGatheringPolicy() {
485 return continualGatheringPolicy;
486 }
487
488 @CalledByNative("RTCConfiguration")
489 int getIceCandidatePoolSize() {
490 return iceCandidatePoolSize;
491 }
492
493 @CalledByNative("RTCConfiguration")
494 boolean getPruneTurnPorts() {
495 return pruneTurnPorts;
496 }
497
498 @CalledByNative("RTCConfiguration")
499 boolean getPresumeWritableWhenFullyRelayed() {
500 return presumeWritableWhenFullyRelayed;
501 }
502
503 @CalledByNative("RTCConfiguration")
504 Integer getIceCheckMinInterval() {
505 return iceCheckMinInterval;
506 }
507
508 @CalledByNative("RTCConfiguration")
Qingsi Wangdb53f8e2018-02-20 14:45:49 -0800509 Integer getStunCandidateKeepaliveInterval() {
510 return stunCandidateKeepaliveIntervalMs;
511 }
512
513 @CalledByNative("RTCConfiguration")
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100514 boolean getDisableIPv6OnWifi() {
515 return disableIPv6OnWifi;
516 }
517
518 @CalledByNative("RTCConfiguration")
519 int getMaxIPv6Networks() {
520 return maxIPv6Networks;
521 }
522
523 @CalledByNative("RTCConfiguration")
524 IntervalRange getIceRegatherIntervalRange() {
525 return iceRegatherIntervalRange;
526 }
527
528 @CalledByNative("RTCConfiguration")
529 TurnCustomizer getTurnCustomizer() {
530 return turnCustomizer;
531 }
Sami Kalliomäkie8b26cd2017-12-19 12:51:53 +0100532
533 @CalledByNative("RTCConfiguration")
534 boolean getDisableIpv6() {
535 return disableIpv6;
536 }
537
538 @CalledByNative("RTCConfiguration")
539 boolean getEnableDscp() {
540 return enableDscp;
541 }
542
543 @CalledByNative("RTCConfiguration")
544 boolean getEnableCpuOveruseDetection() {
545 return enableCpuOveruseDetection;
546 }
547
548 @CalledByNative("RTCConfiguration")
549 boolean getEnableRtpDataChannel() {
550 return enableRtpDataChannel;
551 }
552
553 @CalledByNative("RTCConfiguration")
554 boolean getSuspendBelowMinBitrate() {
555 return suspendBelowMinBitrate;
556 }
557
558 @CalledByNative("RTCConfiguration")
559 Integer getScreencastMinBitrate() {
560 return screencastMinBitrate;
561 }
562
563 @CalledByNative("RTCConfiguration")
564 Boolean getCombinedAudioVideoBwe() {
565 return combinedAudioVideoBwe;
566 }
567
568 @CalledByNative("RTCConfiguration")
569 Boolean getEnableDtlsSrtp() {
570 return enableDtlsSrtp;
571 }
Qingsi Wang9a5c6f82018-02-01 10:38:40 -0800572
573 @CalledByNative("RTCConfiguration")
574 AdapterType getNetworkPreference() {
575 return networkPreference;
576 }
Jiayang Liucac1b382015-04-30 12:35:24 -0700577 };
578
Magnus Jedvert6062f372017-11-16 16:53:12 +0100579 private final List<MediaStream> localStreams = new ArrayList<>();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000580 private final long nativePeerConnection;
Magnus Jedvert6062f372017-11-16 16:53:12 +0100581 private List<RtpSender> senders = new ArrayList<>();
582 private List<RtpReceiver> receivers = new ArrayList<>();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000583
Sami Kalliomäki1ece1ed2017-12-20 11:59:22 +0100584 /**
585 * Wraps a PeerConnection created by the factory. Can be used by clients that want to implement
586 * their PeerConnection creation in JNI.
587 */
588 public PeerConnection(NativePeerConnectionFactory factory) {
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100589 this(factory.createNativePeerConnection());
Sami Kalliomäki1ece1ed2017-12-20 11:59:22 +0100590 }
591
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100592 PeerConnection(long nativePeerConnection) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000593 this.nativePeerConnection = nativePeerConnection;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000594 }
595
596 // JsepInterface.
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100597 public SessionDescription getLocalDescription() {
598 return nativeGetLocalDescription();
599 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000600
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100601 public SessionDescription getRemoteDescription() {
602 return nativeGetRemoteDescription();
603 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000604
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100605 public DataChannel createDataChannel(String label, DataChannel.Init init) {
606 return nativeCreateDataChannel(label, init);
607 }
henrike@webrtc.org723d6832013-07-12 16:04:50 +0000608
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100609 public void createOffer(SdpObserver observer, MediaConstraints constraints) {
610 nativeCreateOffer(observer, constraints);
611 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000612
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100613 public void createAnswer(SdpObserver observer, MediaConstraints constraints) {
614 nativeCreateAnswer(observer, constraints);
615 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000616
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100617 public void setLocalDescription(SdpObserver observer, SessionDescription sdp) {
618 nativeSetLocalDescription(observer, sdp);
619 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000620
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100621 public void setRemoteDescription(SdpObserver observer, SessionDescription sdp) {
622 nativeSetRemoteDescription(observer, sdp);
623 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000624
henrika5f6bf242017-11-01 11:06:56 +0100625 // True if remote audio should be played out. Defaults to true.
626 // Note that even if playout is enabled, streams will only be played out if
627 // the appropriate SDP is also applied. The main purpose of this API is to
628 // be able to control the exact time when audio playout starts.
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100629 public void setAudioPlayout(boolean playout) {
630 nativeSetAudioPlayout(playout);
631 }
henrika5f6bf242017-11-01 11:06:56 +0100632
633 // True if local audio shall be recorded. Defaults to true.
634 // Note that even if recording is enabled, streams will only be recorded if
635 // the appropriate SDP is also applied. The main purpose of this API is to
636 // be able to control the exact time when audio recording starts.
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100637 public void setAudioRecording(boolean recording) {
638 nativeSetAudioRecording(recording);
639 }
henrika5f6bf242017-11-01 11:06:56 +0100640
deadbeef5d0b6d82017-01-09 16:05:28 -0800641 public boolean setConfiguration(RTCConfiguration config) {
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100642 return nativeSetConfiguration(config);
deadbeef5d0b6d82017-01-09 16:05:28 -0800643 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000644
645 public boolean addIceCandidate(IceCandidate candidate) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100646 return nativeAddIceCandidate(candidate.sdpMid, candidate.sdpMLineIndex, candidate.sdp);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000647 }
648
Honghai Zhang7fb69db2016-03-14 11:59:18 -0700649 public boolean removeIceCandidates(final IceCandidate[] candidates) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100650 return nativeRemoveIceCandidates(candidates);
Honghai Zhang7fb69db2016-03-14 11:59:18 -0700651 }
652
perkj@webrtc.orgc2dd5ee2014-11-04 11:31:29 +0000653 public boolean addStream(MediaStream stream) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100654 boolean ret = nativeAddLocalStream(stream.nativeStream);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000655 if (!ret) {
656 return false;
657 }
658 localStreams.add(stream);
659 return true;
660 }
661
662 public void removeStream(MediaStream stream) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100663 nativeRemoveLocalStream(stream.nativeStream);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000664 localStreams.remove(stream);
665 }
666
deadbeef7a246882017-08-09 08:40:10 -0700667 /**
668 * Creates an RtpSender without a track.
669 * <p>
670 * This method allows an application to cause the PeerConnection to negotiate
671 * sending/receiving a specific media type, but without having a track to
672 * send yet.
673 * <p>
674 * When the application does want to begin sending a track, it can call
675 * RtpSender.setTrack, which doesn't require any additional SDP negotiation.
676 * <p>
677 * Example use:
678 * <pre>
679 * {@code
680 * audioSender = pc.createSender("audio", "stream1");
681 * videoSender = pc.createSender("video", "stream1");
682 * // Do normal SDP offer/answer, which will kick off ICE/DTLS and negotiate
683 * // media parameters....
684 * // Later, when the endpoint is ready to actually begin sending:
685 * audioSender.setTrack(audioTrack, false);
686 * videoSender.setTrack(videoTrack, false);
687 * }
688 * </pre>
689 * Note: This corresponds most closely to "addTransceiver" in the official
690 * WebRTC API, in that it creates a sender without a track. It was
691 * implemented before addTransceiver because it provides useful
692 * functionality, and properly implementing transceivers would have required
693 * a great deal more work.
694 *
695 * @param kind Corresponds to MediaStreamTrack kinds (must be "audio" or
696 * "video").
697 * @param stream_id The ID of the MediaStream that this sender's track will
698 * be associated with when SDP is applied to the remote
699 * PeerConnection. If createSender is used to create an
700 * audio and video sender that should be synchronized, they
701 * should use the same stream ID.
702 * @return A new RtpSender object if successful, or null otherwise.
703 */
deadbeefbd7d8f72015-12-18 16:58:44 -0800704 public RtpSender createSender(String kind, String stream_id) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100705 RtpSender new_sender = nativeCreateSender(kind, stream_id);
deadbeefee524f72015-12-02 11:27:40 -0800706 if (new_sender != null) {
707 senders.add(new_sender);
708 }
709 return new_sender;
710 }
711
deadbeef4139c0f2015-10-06 12:29:25 -0700712 // Note that calling getSenders will dispose of the senders previously
713 // returned (and same goes for getReceivers).
714 public List<RtpSender> getSenders() {
715 for (RtpSender sender : senders) {
716 sender.dispose();
717 }
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100718 senders = nativeGetSenders();
deadbeef4139c0f2015-10-06 12:29:25 -0700719 return Collections.unmodifiableList(senders);
720 }
721
722 public List<RtpReceiver> getReceivers() {
723 for (RtpReceiver receiver : receivers) {
724 receiver.dispose();
725 }
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100726 receivers = nativeGetReceivers();
deadbeef4139c0f2015-10-06 12:29:25 -0700727 return Collections.unmodifiableList(receivers);
728 }
729
deadbeef82215872017-04-18 10:27:51 -0700730 // Older, non-standard implementation of getStats.
731 @Deprecated
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000732 public boolean getStats(StatsObserver observer, MediaStreamTrack track) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100733 return nativeOldGetStats(observer, (track == null) ? 0 : track.nativeTrack);
deadbeef82215872017-04-18 10:27:51 -0700734 }
735
736 // Gets stats using the new stats collection API, see webrtc/api/stats/. These
737 // will replace old stats collection API when the new API has matured enough.
738 public void getStats(RTCStatsCollectorCallback callback) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100739 nativeNewGetStats(callback);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000740 }
741
zsteind89b0bc2017-08-03 11:11:40 -0700742 // Limits the bandwidth allocated for all RTP streams sent by this
743 // PeerConnection. Pass null to leave a value unchanged.
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100744 public boolean setBitrate(Integer min, Integer current, Integer max) {
745 return nativeSetBitrate(min, current, max);
746 }
zsteind89b0bc2017-08-03 11:11:40 -0700747
ivoc14d5dbe2016-07-04 07:06:55 -0700748 // Starts recording an RTC event log. Ownership of the file is transfered to
749 // the native code. If an RTC event log is already being recorded, it will be
750 // stopped and a new one will start using the provided file. Logging will
751 // continue until the stopRtcEventLog function is called. The max_size_bytes
752 // argument is ignored, it is added for future use.
ivoc0c6f0f62016-07-06 04:34:23 -0700753 public boolean startRtcEventLog(int file_descriptor, int max_size_bytes) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100754 return nativeStartRtcEventLog(file_descriptor, max_size_bytes);
ivoc14d5dbe2016-07-04 07:06:55 -0700755 }
756
757 // Stops recording an RTC event log. If no RTC event log is currently being
758 // recorded, this call will have no effect.
759 public void stopRtcEventLog() {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100760 nativeStopRtcEventLog();
ivoc14d5dbe2016-07-04 07:06:55 -0700761 }
762
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000763 // TODO(fischman): add support for DTMF-related methods once that API
764 // stabilizes.
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100765 public SignalingState signalingState() {
766 return nativeSignalingState();
767 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000768
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100769 public IceConnectionState iceConnectionState() {
770 return nativeIceConnectionState();
771 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000772
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100773 public IceGatheringState iceGatheringState() {
774 return nativeIceGatheringState();
775 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000776
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100777 public void close() {
778 nativeClose();
779 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000780
deadbeef43697f62017-09-12 10:52:14 -0700781 /**
782 * Free native resources associated with this PeerConnection instance.
783 * <p>
784 * This method removes a reference count from the C++ PeerConnection object,
785 * which should result in it being destroyed. It also calls equivalent
786 * "dispose" methods on the Java objects attached to this PeerConnection
787 * (streams, senders, receivers), such that their associated C++ objects
788 * will also be destroyed.
789 * <p>
790 * Note that this method cannot be safely called from an observer callback
791 * (PeerConnection.Observer, DataChannel.Observer, etc.). If you want to, for
792 * example, destroy the PeerConnection after an "ICE failed" callback, you
793 * must do this asynchronously (in other words, unwind the stack first). See
794 * <a href="https://bugs.chromium.org/p/webrtc/issues/detail?id=3721">bug
795 * 3721</a> for more details.
796 */
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000797 public void dispose() {
798 close();
799 for (MediaStream stream : localStreams) {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100800 nativeRemoveLocalStream(stream.nativeStream);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000801 stream.dispose();
802 }
803 localStreams.clear();
deadbeef4139c0f2015-10-06 12:29:25 -0700804 for (RtpSender sender : senders) {
805 sender.dispose();
806 }
807 senders.clear();
808 for (RtpReceiver receiver : receivers) {
809 receiver.dispose();
810 }
811 receivers.clear();
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100812 nativeFreeOwnedPeerConnection(nativePeerConnection);
813 }
814
815 /** Returns a pointer to the native webrtc::PeerConnectionInterface. */
816 public long getNativePeerConnection() {
817 return nativeGetNativePeerConnection();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000818 }
819
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100820 @CalledByNative
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100821 long getNativeOwnedPeerConnection() {
Magnus Jedvert9060eb12017-12-12 12:52:54 +0100822 return nativePeerConnection;
823 }
824
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100825 public static long createNativePeerConnectionObserver(Observer observer) {
826 return nativeCreatePeerConnectionObserver(observer);
827 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000828
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100829 private native long nativeGetNativePeerConnection();
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100830 private native SessionDescription nativeGetLocalDescription();
831 private native SessionDescription nativeGetRemoteDescription();
832 private native DataChannel nativeCreateDataChannel(String label, DataChannel.Init init);
833 private native void nativeCreateOffer(SdpObserver observer, MediaConstraints constraints);
834 private native void nativeCreateAnswer(SdpObserver observer, MediaConstraints constraints);
835 private native void nativeSetLocalDescription(SdpObserver observer, SessionDescription sdp);
836 private native void nativeSetRemoteDescription(SdpObserver observer, SessionDescription sdp);
837 private native void nativeSetAudioPlayout(boolean playout);
838 private native void nativeSetAudioRecording(boolean recording);
839 private native boolean nativeSetBitrate(Integer min, Integer current, Integer max);
840 private native SignalingState nativeSignalingState();
841 private native IceConnectionState nativeIceConnectionState();
842 private native IceGatheringState nativeIceGatheringState();
843 private native void nativeClose();
844 private static native long nativeCreatePeerConnectionObserver(Observer observer);
Sami Kalliomäkice5c19a2018-01-15 09:28:34 +0100845 private static native void nativeFreeOwnedPeerConnection(long ownedPeerConnection);
846 private native boolean nativeSetConfiguration(RTCConfiguration config);
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100847 private native boolean nativeAddIceCandidate(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000848 String sdpMid, int sdpMLineIndex, String iceCandidateSdp);
Magnus Jedvert84d8ae52017-12-20 15:12:10 +0100849 private native boolean nativeRemoveIceCandidates(final IceCandidate[] candidates);
850 private native boolean nativeAddLocalStream(long stream);
851 private native void nativeRemoveLocalStream(long stream);
852 private native boolean nativeOldGetStats(StatsObserver observer, long nativeTrack);
853 private native void nativeNewGetStats(RTCStatsCollectorCallback callback);
854 private native RtpSender nativeCreateSender(String kind, String stream_id);
855 private native List<RtpSender> nativeGetSenders();
856 private native List<RtpReceiver> nativeGetReceivers();
857 private native boolean nativeStartRtcEventLog(int file_descriptor, int max_size_bytes);
858 private native void nativeStopRtcEventLog();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000859}