henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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 |
| 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.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 11 | package org.webrtc; |
| 12 | |
Magnus Jedvert | 6062f37 | 2017-11-16 16:53:12 +0100 | [diff] [blame] | 13 | import java.util.ArrayList; |
Sami Kalliomäki | 3e189a6 | 2017-11-24 11:13:39 +0100 | [diff] [blame] | 14 | import java.util.Collections; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 15 | import 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 | */ |
| 23 | public class PeerConnection { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 24 | /** Tracks PeerConnectionInterface::IceGatheringState */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 25 | public enum IceGatheringState { |
| 26 | NEW, |
| 27 | GATHERING, |
| 28 | COMPLETE; |
| 29 | |
| 30 | @CalledByNative("IceGatheringState") |
| 31 | static IceGatheringState fromNativeIndex(int nativeIndex) { |
| 32 | return values()[nativeIndex]; |
| 33 | } |
| 34 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 35 | |
| 36 | /** Tracks PeerConnectionInterface::IceConnectionState */ |
| 37 | public enum IceConnectionState { |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 38 | NEW, |
| 39 | CHECKING, |
| 40 | CONNECTED, |
| 41 | COMPLETED, |
| 42 | FAILED, |
| 43 | DISCONNECTED, |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 44 | CLOSED; |
| 45 | |
| 46 | @CalledByNative("IceConnectionState") |
| 47 | static IceConnectionState fromNativeIndex(int nativeIndex) { |
| 48 | return values()[nativeIndex]; |
| 49 | } |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 50 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 51 | |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 52 | /** Tracks PeerConnectionInterface::TlsCertPolicy */ |
| 53 | public enum TlsCertPolicy { |
| 54 | TLS_CERT_POLICY_SECURE, |
| 55 | TLS_CERT_POLICY_INSECURE_NO_CHECK, |
| 56 | } |
| 57 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 58 | /** Tracks PeerConnectionInterface::SignalingState */ |
| 59 | public enum SignalingState { |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 60 | STABLE, |
| 61 | HAVE_LOCAL_OFFER, |
| 62 | HAVE_LOCAL_PRANSWER, |
| 63 | HAVE_REMOTE_OFFER, |
| 64 | HAVE_REMOTE_PRANSWER, |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 65 | CLOSED; |
| 66 | |
| 67 | @CalledByNative("SignalingState") |
| 68 | static SignalingState fromNativeIndex(int nativeIndex) { |
| 69 | return values()[nativeIndex]; |
| 70 | } |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 71 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 72 | |
| 73 | /** Java version of PeerConnectionObserver. */ |
| 74 | public static interface Observer { |
| 75 | /** Triggered when the SignalingState changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 76 | @CalledByNative("Observer") void onSignalingChange(SignalingState newState); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 77 | |
| 78 | /** Triggered when the IceConnectionState changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 79 | @CalledByNative("Observer") void onIceConnectionChange(IceConnectionState newState); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 80 | |
Peter Thatcher | 5436051 | 2015-07-08 11:08:35 -0700 | [diff] [blame] | 81 | /** Triggered when the ICE connection receiving status changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 82 | @CalledByNative("Observer") void onIceConnectionReceivingChange(boolean receiving); |
Peter Thatcher | 5436051 | 2015-07-08 11:08:35 -0700 | [diff] [blame] | 83 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 84 | /** Triggered when the IceGatheringState changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 85 | @CalledByNative("Observer") void onIceGatheringChange(IceGatheringState newState); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 86 | |
| 87 | /** Triggered when a new ICE candidate has been found. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 88 | @CalledByNative("Observer") void onIceCandidate(IceCandidate candidate); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 89 | |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 90 | /** Triggered when some ICE candidates have been removed. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 91 | @CalledByNative("Observer") void onIceCandidatesRemoved(IceCandidate[] candidates); |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 92 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 93 | /** Triggered when media is received on a new stream from remote peer. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 94 | @CalledByNative("Observer") void onAddStream(MediaStream stream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 95 | |
| 96 | /** Triggered when a remote peer close a stream. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 97 | @CalledByNative("Observer") void onRemoveStream(MediaStream stream); |
henrike@webrtc.org | 723d683 | 2013-07-12 16:04:50 +0000 | [diff] [blame] | 98 | |
| 99 | /** Triggered when a remote peer opens a DataChannel. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 100 | @CalledByNative("Observer") void onDataChannel(DataChannel dataChannel); |
fischman@webrtc.org | d7568a0 | 2014-01-13 22:04:12 +0000 | [diff] [blame] | 101 | |
| 102 | /** Triggered when renegotiation is necessary. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 103 | @CalledByNative("Observer") void onRenegotiationNeeded(); |
zhihuang | dcccda7 | 2016-12-21 14:08:03 -0800 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * Triggered when a new track is signaled by the remote peer, as a result of |
| 107 | * setRemoteDescription. |
| 108 | */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 109 | @CalledByNative("Observer") void onAddTrack(RtpReceiver receiver, MediaStream[] mediaStreams); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | /** Java version of PeerConnectionInterface.IceServer. */ |
| 113 | public static class IceServer { |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 114 | // List of URIs associated with this server. Valid formats are described |
| 115 | // in RFC7064 and RFC7065, and more may be added in the future. The "host" |
| 116 | // part of the URI may contain either an IP address or a hostname. |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 117 | @Deprecated public final String uri; |
| 118 | public final List<String> urls; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 119 | public final String username; |
| 120 | public final String password; |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 121 | public final TlsCertPolicy tlsCertPolicy; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 122 | |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 123 | // If the URIs in |urls| only contain IP addresses, this field can be used |
| 124 | // to indicate the hostname, which may be necessary for TLS (using the SNI |
| 125 | // extension). If |urls| itself contains the hostname, this isn't |
| 126 | // necessary. |
| 127 | public final String hostname; |
| 128 | |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 129 | // List of protocols to be used in the TLS ALPN extension. |
| 130 | public final List<String> tlsAlpnProtocols; |
| 131 | |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 132 | // List of elliptic curves to be used in the TLS elliptic curves extension. |
| 133 | // Only curve names supported by OpenSSL should be used (eg. "P-256","X25519"). |
| 134 | public final List<String> tlsEllipticCurves; |
| 135 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 136 | /** Convenience constructor for STUN servers. */ |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 137 | @Deprecated |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 138 | public IceServer(String uri) { |
| 139 | this(uri, "", ""); |
| 140 | } |
| 141 | |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 142 | @Deprecated |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 143 | public IceServer(String uri, String username, String password) { |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 144 | this(uri, username, password, TlsCertPolicy.TLS_CERT_POLICY_SECURE); |
| 145 | } |
| 146 | |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 147 | @Deprecated |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 148 | public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) { |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 149 | this(uri, username, password, tlsCertPolicy, ""); |
| 150 | } |
| 151 | |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 152 | @Deprecated |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 153 | public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy, |
| 154 | String hostname) { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 155 | this(uri, Collections.singletonList(uri), username, password, tlsCertPolicy, hostname, null, |
| 156 | null); |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 157 | } |
| 158 | |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 159 | private IceServer(String uri, List<String> urls, String username, String password, |
| 160 | TlsCertPolicy tlsCertPolicy, String hostname, List<String> tlsAlpnProtocols, |
| 161 | List<String> tlsEllipticCurves) { |
| 162 | if (uri == null || urls == null || urls.isEmpty()) { |
| 163 | throw new IllegalArgumentException("uri == null || urls == null || urls.isEmpty()"); |
| 164 | } |
| 165 | for (String it : urls) { |
| 166 | if (it == null) { |
| 167 | throw new IllegalArgumentException("urls element is null: " + urls); |
| 168 | } |
| 169 | } |
| 170 | if (username == null) { |
| 171 | throw new IllegalArgumentException("username == null"); |
| 172 | } |
| 173 | if (password == null) { |
| 174 | throw new IllegalArgumentException("password == null"); |
| 175 | } |
| 176 | if (hostname == null) { |
| 177 | throw new IllegalArgumentException("hostname == null"); |
| 178 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 179 | this.uri = uri; |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 180 | this.urls = urls; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 181 | this.username = username; |
| 182 | this.password = password; |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 183 | this.tlsCertPolicy = tlsCertPolicy; |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 184 | this.hostname = hostname; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 185 | this.tlsAlpnProtocols = tlsAlpnProtocols; |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 186 | this.tlsEllipticCurves = tlsEllipticCurves; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 187 | } |
| 188 | |
Sami Kalliomäki | bde473e | 2017-10-30 13:34:41 +0100 | [diff] [blame] | 189 | @Override |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 190 | public String toString() { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 191 | return urls + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 192 | + "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]"; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | public static Builder builder(String uri) { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 196 | return new Builder(Collections.singletonList(uri)); |
| 197 | } |
| 198 | |
| 199 | public static Builder builder(List<String> urls) { |
| 200 | return new Builder(urls); |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | public static class Builder { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 204 | private final List<String> urls; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 205 | private String username = ""; |
| 206 | private String password = ""; |
| 207 | private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE; |
| 208 | private String hostname = ""; |
| 209 | private List<String> tlsAlpnProtocols; |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 210 | private List<String> tlsEllipticCurves; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 211 | |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 212 | private Builder(List<String> urls) { |
| 213 | if (urls == null || urls.isEmpty()) { |
| 214 | throw new IllegalArgumentException("urls == null || urls.isEmpty(): " + urls); |
| 215 | } |
| 216 | this.urls = urls; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | public Builder setUsername(String username) { |
| 220 | this.username = username; |
| 221 | return this; |
| 222 | } |
| 223 | |
| 224 | public Builder setPassword(String password) { |
| 225 | this.password = password; |
| 226 | return this; |
| 227 | } |
| 228 | |
| 229 | public Builder setTlsCertPolicy(TlsCertPolicy tlsCertPolicy) { |
| 230 | this.tlsCertPolicy = tlsCertPolicy; |
| 231 | return this; |
| 232 | } |
| 233 | |
| 234 | public Builder setHostname(String hostname) { |
| 235 | this.hostname = hostname; |
| 236 | return this; |
| 237 | } |
| 238 | |
| 239 | public Builder setTlsAlpnProtocols(List<String> tlsAlpnProtocols) { |
| 240 | this.tlsAlpnProtocols = tlsAlpnProtocols; |
| 241 | return this; |
| 242 | } |
| 243 | |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 244 | public Builder setTlsEllipticCurves(List<String> tlsEllipticCurves) { |
| 245 | this.tlsEllipticCurves = tlsEllipticCurves; |
| 246 | return this; |
| 247 | } |
| 248 | |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 249 | public IceServer createIceServer() { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 250 | return new IceServer(urls.get(0), urls, username, password, tlsCertPolicy, hostname, |
| 251 | tlsAlpnProtocols, tlsEllipticCurves); |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 252 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 256 | /** Java version of PeerConnectionInterface.IceTransportsType */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 257 | public enum IceTransportsType { NONE, RELAY, NOHOST, ALL } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 258 | |
| 259 | /** Java version of PeerConnectionInterface.BundlePolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 260 | public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 261 | |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 262 | /** Java version of PeerConnectionInterface.RtcpMuxPolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 263 | public enum RtcpMuxPolicy { NEGOTIATE, REQUIRE } |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 264 | |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 265 | /** Java version of PeerConnectionInterface.TcpCandidatePolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 266 | public enum TcpCandidatePolicy { ENABLED, DISABLED } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 267 | |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 268 | /** Java version of PeerConnectionInterface.CandidateNetworkPolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 269 | public enum CandidateNetworkPolicy { ALL, LOW_COST } |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 270 | |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 271 | /** Java version of rtc::KeyType */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 272 | public enum KeyType { RSA, ECDSA } |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 273 | |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 274 | /** Java version of PeerConnectionInterface.ContinualGatheringPolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 275 | public enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY } |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 276 | |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 277 | /** Java version of rtc::IntervalRange */ |
| 278 | public static class IntervalRange { |
| 279 | private final int min; |
| 280 | private final int max; |
| 281 | |
| 282 | public IntervalRange(int min, int max) { |
| 283 | this.min = min; |
| 284 | this.max = max; |
| 285 | } |
| 286 | |
| 287 | public int getMin() { |
| 288 | return min; |
| 289 | } |
| 290 | |
| 291 | public int getMax() { |
| 292 | return max; |
| 293 | } |
| 294 | } |
| 295 | |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 296 | /** Java version of PeerConnectionInterface.RTCConfiguration */ |
| 297 | public static class RTCConfiguration { |
| 298 | public IceTransportsType iceTransportsType; |
| 299 | public List<IceServer> iceServers; |
| 300 | public BundlePolicy bundlePolicy; |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 301 | public RtcpMuxPolicy rtcpMuxPolicy; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 302 | public TcpCandidatePolicy tcpCandidatePolicy; |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 303 | public CandidateNetworkPolicy candidateNetworkPolicy; |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 304 | public int audioJitterBufferMaxPackets; |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 305 | public boolean audioJitterBufferFastAccelerate; |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 306 | public int iceConnectionReceivingTimeout; |
Honghai Zhang | 381b421 | 2015-12-04 12:24:03 -0800 | [diff] [blame] | 307 | public int iceBackupCandidatePairPingInterval; |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 308 | public KeyType keyType; |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 309 | public ContinualGatheringPolicy continualGatheringPolicy; |
deadbeef | be0c96f | 2016-05-18 16:20:14 -0700 | [diff] [blame] | 310 | public int iceCandidatePoolSize; |
Honghai Zhang | d78ecf7 | 2016-07-01 14:40:40 -0700 | [diff] [blame] | 311 | public boolean pruneTurnPorts; |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 312 | public boolean presumeWritableWhenFullyRelayed; |
skvlad | 5107246 | 2017-02-02 11:50:14 -0800 | [diff] [blame] | 313 | public Integer iceCheckMinInterval; |
zhihuang | b09b3f9 | 2017-03-07 14:40:51 -0800 | [diff] [blame] | 314 | public boolean disableIPv6OnWifi; |
deadbeef | 28e2919 | 2017-07-27 09:14:38 -0700 | [diff] [blame] | 315 | // By default, PeerConnection will use a limited number of IPv6 network |
| 316 | // interfaces, in order to avoid too many ICE candidate pairs being created |
| 317 | // and delaying ICE completion. |
| 318 | // |
| 319 | // Can be set to Integer.MAX_VALUE to effectively disable the limit. |
| 320 | public int maxIPv6Networks; |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 321 | public IntervalRange iceRegatherIntervalRange; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 322 | |
Jonas Oreland | bdcee28 | 2017-10-10 14:01:40 +0200 | [diff] [blame] | 323 | // This is an optional wrapper for the C++ webrtc::TurnCustomizer. |
| 324 | public TurnCustomizer turnCustomizer; |
| 325 | |
deadbeef | 28e2919 | 2017-07-27 09:14:38 -0700 | [diff] [blame] | 326 | // TODO(deadbeef): Instead of duplicating the defaults here, we should do |
| 327 | // something to pick up the defaults from C++. The Objective-C equivalent |
| 328 | // of RTCConfiguration does that. |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 329 | public RTCConfiguration(List<IceServer> iceServers) { |
| 330 | iceTransportsType = IceTransportsType.ALL; |
| 331 | bundlePolicy = BundlePolicy.BALANCED; |
zhihuang | 4dfb8ce | 2016-11-23 10:30:12 -0800 | [diff] [blame] | 332 | rtcpMuxPolicy = RtcpMuxPolicy.REQUIRE; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 333 | tcpCandidatePolicy = TcpCandidatePolicy.ENABLED; |
Sami Kalliomäki | 9828beb | 2017-10-26 16:21:22 +0200 | [diff] [blame] | 334 | candidateNetworkPolicy = CandidateNetworkPolicy.ALL; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 335 | this.iceServers = iceServers; |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 336 | audioJitterBufferMaxPackets = 50; |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 337 | audioJitterBufferFastAccelerate = false; |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 338 | iceConnectionReceivingTimeout = -1; |
Honghai Zhang | 381b421 | 2015-12-04 12:24:03 -0800 | [diff] [blame] | 339 | iceBackupCandidatePairPingInterval = -1; |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 340 | keyType = KeyType.ECDSA; |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 341 | continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE; |
deadbeef | be0c96f | 2016-05-18 16:20:14 -0700 | [diff] [blame] | 342 | iceCandidatePoolSize = 0; |
Honghai Zhang | d78ecf7 | 2016-07-01 14:40:40 -0700 | [diff] [blame] | 343 | pruneTurnPorts = false; |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 344 | presumeWritableWhenFullyRelayed = false; |
skvlad | 5107246 | 2017-02-02 11:50:14 -0800 | [diff] [blame] | 345 | iceCheckMinInterval = null; |
zhihuang | b09b3f9 | 2017-03-07 14:40:51 -0800 | [diff] [blame] | 346 | disableIPv6OnWifi = false; |
deadbeef | 28e2919 | 2017-07-27 09:14:38 -0700 | [diff] [blame] | 347 | maxIPv6Networks = 5; |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 348 | iceRegatherIntervalRange = null; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 349 | } |
| 350 | }; |
| 351 | |
Magnus Jedvert | 6062f37 | 2017-11-16 16:53:12 +0100 | [diff] [blame] | 352 | private final List<MediaStream> localStreams = new ArrayList<>(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 353 | private final long nativePeerConnection; |
| 354 | private final long nativeObserver; |
Magnus Jedvert | 6062f37 | 2017-11-16 16:53:12 +0100 | [diff] [blame] | 355 | private List<RtpSender> senders = new ArrayList<>(); |
| 356 | private List<RtpReceiver> receivers = new ArrayList<>(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 357 | |
| 358 | PeerConnection(long nativePeerConnection, long nativeObserver) { |
| 359 | this.nativePeerConnection = nativePeerConnection; |
| 360 | this.nativeObserver = nativeObserver; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 361 | } |
| 362 | |
| 363 | // JsepInterface. |
| 364 | public native SessionDescription getLocalDescription(); |
| 365 | |
| 366 | public native SessionDescription getRemoteDescription(); |
| 367 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 368 | public native DataChannel createDataChannel(String label, DataChannel.Init init); |
henrike@webrtc.org | 723d683 | 2013-07-12 16:04:50 +0000 | [diff] [blame] | 369 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 370 | public native void createOffer(SdpObserver observer, MediaConstraints constraints); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 371 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 372 | public native void createAnswer(SdpObserver observer, MediaConstraints constraints); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 373 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 374 | public native void setLocalDescription(SdpObserver observer, SessionDescription sdp); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 375 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 376 | public native void setRemoteDescription(SdpObserver observer, SessionDescription sdp); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 377 | |
henrika | 5f6bf24 | 2017-11-01 11:06:56 +0100 | [diff] [blame] | 378 | // True if remote audio should be played out. Defaults to true. |
| 379 | // Note that even if playout is enabled, streams will only be played out if |
| 380 | // the appropriate SDP is also applied. The main purpose of this API is to |
| 381 | // be able to control the exact time when audio playout starts. |
| 382 | public native void setAudioPlayout(boolean playout); |
| 383 | |
| 384 | // True if local audio shall be recorded. Defaults to true. |
| 385 | // Note that even if recording is enabled, streams will only be recorded if |
| 386 | // the appropriate SDP is also applied. The main purpose of this API is to |
| 387 | // be able to control the exact time when audio recording starts. |
| 388 | public native void setAudioRecording(boolean recording); |
| 389 | |
deadbeef | 5d0b6d8 | 2017-01-09 16:05:28 -0800 | [diff] [blame] | 390 | public boolean setConfiguration(RTCConfiguration config) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 391 | return setNativeConfiguration(config, nativeObserver); |
deadbeef | 5d0b6d8 | 2017-01-09 16:05:28 -0800 | [diff] [blame] | 392 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 393 | |
| 394 | public boolean addIceCandidate(IceCandidate candidate) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 395 | return addNativeIceCandidate(candidate.sdpMid, candidate.sdpMLineIndex, candidate.sdp); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 396 | } |
| 397 | |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 398 | public boolean removeIceCandidates(final IceCandidate[] candidates) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 399 | return removeNativeIceCandidates(candidates); |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 400 | } |
| 401 | |
perkj@webrtc.org | c2dd5ee | 2014-11-04 11:31:29 +0000 | [diff] [blame] | 402 | public boolean addStream(MediaStream stream) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 403 | boolean ret = addNativeLocalStream(stream.nativeStream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 404 | if (!ret) { |
| 405 | return false; |
| 406 | } |
| 407 | localStreams.add(stream); |
| 408 | return true; |
| 409 | } |
| 410 | |
| 411 | public void removeStream(MediaStream stream) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 412 | removeNativeLocalStream(stream.nativeStream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 413 | localStreams.remove(stream); |
| 414 | } |
| 415 | |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 416 | /** |
| 417 | * Creates an RtpSender without a track. |
| 418 | * <p> |
| 419 | * This method allows an application to cause the PeerConnection to negotiate |
| 420 | * sending/receiving a specific media type, but without having a track to |
| 421 | * send yet. |
| 422 | * <p> |
| 423 | * When the application does want to begin sending a track, it can call |
| 424 | * RtpSender.setTrack, which doesn't require any additional SDP negotiation. |
| 425 | * <p> |
| 426 | * Example use: |
| 427 | * <pre> |
| 428 | * {@code |
| 429 | * audioSender = pc.createSender("audio", "stream1"); |
| 430 | * videoSender = pc.createSender("video", "stream1"); |
| 431 | * // Do normal SDP offer/answer, which will kick off ICE/DTLS and negotiate |
| 432 | * // media parameters.... |
| 433 | * // Later, when the endpoint is ready to actually begin sending: |
| 434 | * audioSender.setTrack(audioTrack, false); |
| 435 | * videoSender.setTrack(videoTrack, false); |
| 436 | * } |
| 437 | * </pre> |
| 438 | * Note: This corresponds most closely to "addTransceiver" in the official |
| 439 | * WebRTC API, in that it creates a sender without a track. It was |
| 440 | * implemented before addTransceiver because it provides useful |
| 441 | * functionality, and properly implementing transceivers would have required |
| 442 | * a great deal more work. |
| 443 | * |
| 444 | * @param kind Corresponds to MediaStreamTrack kinds (must be "audio" or |
| 445 | * "video"). |
| 446 | * @param stream_id The ID of the MediaStream that this sender's track will |
| 447 | * be associated with when SDP is applied to the remote |
| 448 | * PeerConnection. If createSender is used to create an |
| 449 | * audio and video sender that should be synchronized, they |
| 450 | * should use the same stream ID. |
| 451 | * @return A new RtpSender object if successful, or null otherwise. |
| 452 | */ |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 453 | public RtpSender createSender(String kind, String stream_id) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 454 | RtpSender new_sender = createNativeSender(kind, stream_id); |
deadbeef | ee524f7 | 2015-12-02 11:27:40 -0800 | [diff] [blame] | 455 | if (new_sender != null) { |
| 456 | senders.add(new_sender); |
| 457 | } |
| 458 | return new_sender; |
| 459 | } |
| 460 | |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 461 | // Note that calling getSenders will dispose of the senders previously |
| 462 | // returned (and same goes for getReceivers). |
| 463 | public List<RtpSender> getSenders() { |
| 464 | for (RtpSender sender : senders) { |
| 465 | sender.dispose(); |
| 466 | } |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 467 | senders = getNativeSenders(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 468 | return Collections.unmodifiableList(senders); |
| 469 | } |
| 470 | |
| 471 | public List<RtpReceiver> getReceivers() { |
| 472 | for (RtpReceiver receiver : receivers) { |
| 473 | receiver.dispose(); |
| 474 | } |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 475 | receivers = getNativeReceivers(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 476 | return Collections.unmodifiableList(receivers); |
| 477 | } |
| 478 | |
deadbeef | 8221587 | 2017-04-18 10:27:51 -0700 | [diff] [blame] | 479 | // Older, non-standard implementation of getStats. |
| 480 | @Deprecated |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 481 | public boolean getStats(StatsObserver observer, MediaStreamTrack track) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 482 | return oldGetNativeStats(observer, (track == null) ? 0 : track.nativeTrack); |
deadbeef | 8221587 | 2017-04-18 10:27:51 -0700 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | // Gets stats using the new stats collection API, see webrtc/api/stats/. These |
| 486 | // will replace old stats collection API when the new API has matured enough. |
| 487 | public void getStats(RTCStatsCollectorCallback callback) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 488 | newGetNativeStats(callback); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 489 | } |
| 490 | |
zstein | d89b0bc | 2017-08-03 11:11:40 -0700 | [diff] [blame] | 491 | // Limits the bandwidth allocated for all RTP streams sent by this |
| 492 | // PeerConnection. Pass null to leave a value unchanged. |
| 493 | public native boolean setBitrate(Integer min, Integer current, Integer max); |
| 494 | |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 495 | // Starts recording an RTC event log. Ownership of the file is transfered to |
| 496 | // the native code. If an RTC event log is already being recorded, it will be |
| 497 | // stopped and a new one will start using the provided file. Logging will |
| 498 | // continue until the stopRtcEventLog function is called. The max_size_bytes |
| 499 | // argument is ignored, it is added for future use. |
ivoc | 0c6f0f6 | 2016-07-06 04:34:23 -0700 | [diff] [blame] | 500 | public boolean startRtcEventLog(int file_descriptor, int max_size_bytes) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 501 | return startNativeRtcEventLog(file_descriptor, max_size_bytes); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | // Stops recording an RTC event log. If no RTC event log is currently being |
| 505 | // recorded, this call will have no effect. |
| 506 | public void stopRtcEventLog() { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 507 | stopNativeRtcEventLog(); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 508 | } |
| 509 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 510 | // TODO(fischman): add support for DTMF-related methods once that API |
| 511 | // stabilizes. |
| 512 | public native SignalingState signalingState(); |
| 513 | |
| 514 | public native IceConnectionState iceConnectionState(); |
| 515 | |
| 516 | public native IceGatheringState iceGatheringState(); |
| 517 | |
| 518 | public native void close(); |
| 519 | |
deadbeef | 43697f6 | 2017-09-12 10:52:14 -0700 | [diff] [blame] | 520 | /** |
| 521 | * Free native resources associated with this PeerConnection instance. |
| 522 | * <p> |
| 523 | * This method removes a reference count from the C++ PeerConnection object, |
| 524 | * which should result in it being destroyed. It also calls equivalent |
| 525 | * "dispose" methods on the Java objects attached to this PeerConnection |
| 526 | * (streams, senders, receivers), such that their associated C++ objects |
| 527 | * will also be destroyed. |
| 528 | * <p> |
| 529 | * Note that this method cannot be safely called from an observer callback |
| 530 | * (PeerConnection.Observer, DataChannel.Observer, etc.). If you want to, for |
| 531 | * example, destroy the PeerConnection after an "ICE failed" callback, you |
| 532 | * must do this asynchronously (in other words, unwind the stack first). See |
| 533 | * <a href="https://bugs.chromium.org/p/webrtc/issues/detail?id=3721">bug |
| 534 | * 3721</a> for more details. |
| 535 | */ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 536 | public void dispose() { |
| 537 | close(); |
| 538 | for (MediaStream stream : localStreams) { |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 539 | removeNativeLocalStream(stream.nativeStream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 540 | stream.dispose(); |
| 541 | } |
| 542 | localStreams.clear(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 543 | for (RtpSender sender : senders) { |
| 544 | sender.dispose(); |
| 545 | } |
| 546 | senders.clear(); |
| 547 | for (RtpReceiver receiver : receivers) { |
| 548 | receiver.dispose(); |
| 549 | } |
| 550 | receivers.clear(); |
magjed | b1c7453 | 2017-08-27 13:47:20 -0700 | [diff] [blame] | 551 | JniCommon.nativeReleaseRef(nativePeerConnection); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 552 | freeObserver(nativeObserver); |
| 553 | } |
| 554 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 555 | private static native void freeObserver(long nativeObserver); |
| 556 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 557 | private native boolean setNativeConfiguration(RTCConfiguration config, long nativeObserver); |
deadbeef | 5d0b6d8 | 2017-01-09 16:05:28 -0800 | [diff] [blame] | 558 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 559 | private native boolean addNativeIceCandidate( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 560 | String sdpMid, int sdpMLineIndex, String iceCandidateSdp); |
| 561 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 562 | private native boolean removeNativeIceCandidates(final IceCandidate[] candidates); |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 563 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 564 | private native boolean addNativeLocalStream(long nativeStream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 565 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 566 | private native void removeNativeLocalStream(long nativeStream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 567 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 568 | private native boolean oldGetNativeStats(StatsObserver observer, long nativeTrack); |
deadbeef | 8221587 | 2017-04-18 10:27:51 -0700 | [diff] [blame] | 569 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 570 | private native void newGetNativeStats(RTCStatsCollectorCallback callback); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 571 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 572 | private native RtpSender createNativeSender(String kind, String stream_id); |
deadbeef | ee524f7 | 2015-12-02 11:27:40 -0800 | [diff] [blame] | 573 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 574 | private native List<RtpSender> getNativeSenders(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 575 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 576 | private native List<RtpReceiver> getNativeReceivers(); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 577 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 578 | private native boolean startNativeRtcEventLog(int file_descriptor, int max_size_bytes); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 579 | |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame^] | 580 | private native void stopNativeRtcEventLog(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 581 | } |