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; |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 16 | import javax.annotation.Nullable; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
| 18 | /** |
| 19 | * Java-land version of the PeerConnection APIs; wraps the C++ API |
| 20 | * http://www.webrtc.org/reference/native-apis, which in turn is inspired by the |
| 21 | * JS APIs: http://dev.w3.org/2011/webrtc/editor/webrtc.html and |
| 22 | * http://www.w3.org/TR/mediacapture-streams/ |
| 23 | */ |
| 24 | public class PeerConnection { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 25 | /** Tracks PeerConnectionInterface::IceGatheringState */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 26 | 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.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 36 | |
| 37 | /** Tracks PeerConnectionInterface::IceConnectionState */ |
| 38 | public enum IceConnectionState { |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 39 | NEW, |
| 40 | CHECKING, |
| 41 | CONNECTED, |
| 42 | COMPLETED, |
| 43 | FAILED, |
| 44 | DISCONNECTED, |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 45 | CLOSED; |
| 46 | |
| 47 | @CalledByNative("IceConnectionState") |
| 48 | static IceConnectionState fromNativeIndex(int nativeIndex) { |
| 49 | return values()[nativeIndex]; |
| 50 | } |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 51 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 52 | |
Jonas Olsson | f01d8c8 | 2018-11-08 15:19:04 +0100 | [diff] [blame^] | 53 | /** Tracks PeerConnectionInterface::PeerConnectionState */ |
| 54 | public enum PeerConnectionState { |
| 55 | NEW, |
| 56 | CONNECTING, |
| 57 | CONNECTED, |
| 58 | DISCONNECTED, |
| 59 | FAILED, |
| 60 | CLOSED; |
| 61 | |
| 62 | @CalledByNative("PeerConnectionState") |
| 63 | static PeerConnectionState fromNativeIndex(int nativeIndex) { |
| 64 | return values()[nativeIndex]; |
| 65 | } |
| 66 | } |
| 67 | |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 68 | /** Tracks PeerConnectionInterface::TlsCertPolicy */ |
| 69 | public enum TlsCertPolicy { |
| 70 | TLS_CERT_POLICY_SECURE, |
| 71 | TLS_CERT_POLICY_INSECURE_NO_CHECK, |
| 72 | } |
| 73 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 74 | /** Tracks PeerConnectionInterface::SignalingState */ |
| 75 | public enum SignalingState { |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 76 | STABLE, |
| 77 | HAVE_LOCAL_OFFER, |
| 78 | HAVE_LOCAL_PRANSWER, |
| 79 | HAVE_REMOTE_OFFER, |
| 80 | HAVE_REMOTE_PRANSWER, |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 81 | CLOSED; |
| 82 | |
| 83 | @CalledByNative("SignalingState") |
| 84 | static SignalingState fromNativeIndex(int nativeIndex) { |
| 85 | return values()[nativeIndex]; |
| 86 | } |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 87 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 88 | |
| 89 | /** Java version of PeerConnectionObserver. */ |
| 90 | public static interface Observer { |
| 91 | /** Triggered when the SignalingState changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 92 | @CalledByNative("Observer") void onSignalingChange(SignalingState newState); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 93 | |
| 94 | /** Triggered when the IceConnectionState changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 95 | @CalledByNative("Observer") void onIceConnectionChange(IceConnectionState newState); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 96 | |
Jonas Olsson | f01d8c8 | 2018-11-08 15:19:04 +0100 | [diff] [blame^] | 97 | /** Triggered when the PeerConnectionState changes. */ |
| 98 | @CalledByNative("Observer") |
| 99 | default void onConnectionChange(PeerConnectionState newState) {} |
| 100 | |
Peter Thatcher | 5436051 | 2015-07-08 11:08:35 -0700 | [diff] [blame] | 101 | /** Triggered when the ICE connection receiving status changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 102 | @CalledByNative("Observer") void onIceConnectionReceivingChange(boolean receiving); |
Peter Thatcher | 5436051 | 2015-07-08 11:08:35 -0700 | [diff] [blame] | 103 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 104 | /** Triggered when the IceGatheringState changes. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 105 | @CalledByNative("Observer") void onIceGatheringChange(IceGatheringState newState); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 106 | |
| 107 | /** Triggered when a new ICE candidate has been found. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 108 | @CalledByNative("Observer") void onIceCandidate(IceCandidate candidate); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 109 | |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 110 | /** Triggered when some ICE candidates have been removed. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 111 | @CalledByNative("Observer") void onIceCandidatesRemoved(IceCandidate[] candidates); |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 112 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 113 | /** Triggered when media is received on a new stream from remote peer. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 114 | @CalledByNative("Observer") void onAddStream(MediaStream stream); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 115 | |
| 116 | /** Triggered when a remote peer close a stream. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 117 | @CalledByNative("Observer") void onRemoveStream(MediaStream stream); |
henrike@webrtc.org | 723d683 | 2013-07-12 16:04:50 +0000 | [diff] [blame] | 118 | |
| 119 | /** Triggered when a remote peer opens a DataChannel. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 120 | @CalledByNative("Observer") void onDataChannel(DataChannel dataChannel); |
fischman@webrtc.org | d7568a0 | 2014-01-13 22:04:12 +0000 | [diff] [blame] | 121 | |
| 122 | /** Triggered when renegotiation is necessary. */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 123 | @CalledByNative("Observer") void onRenegotiationNeeded(); |
zhihuang | dcccda7 | 2016-12-21 14:08:03 -0800 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Triggered when a new track is signaled by the remote peer, as a result of |
| 127 | * setRemoteDescription. |
| 128 | */ |
Magnus Jedvert | ba700f6 | 2017-12-04 13:43:27 +0100 | [diff] [blame] | 129 | @CalledByNative("Observer") void onAddTrack(RtpReceiver receiver, MediaStream[] mediaStreams); |
Seth Hampson | 31dbc24 | 2018-05-07 09:28:19 -0700 | [diff] [blame] | 130 | |
| 131 | /** |
| 132 | * Triggered when the signaling from SetRemoteDescription indicates that a transceiver |
| 133 | * will be receiving media from a remote endpoint. This is only called if UNIFIED_PLAN |
| 134 | * semantics are specified. The transceiver will be disposed automatically. |
| 135 | */ |
| 136 | @CalledByNative("Observer") default void onTrack(RtpTransceiver transceiver){}; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | /** Java version of PeerConnectionInterface.IceServer. */ |
| 140 | public static class IceServer { |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 141 | // List of URIs associated with this server. Valid formats are described |
| 142 | // in RFC7064 and RFC7065, and more may be added in the future. The "host" |
| 143 | // 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] | 144 | @Deprecated public final String uri; |
| 145 | public final List<String> urls; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 146 | public final String username; |
| 147 | public final String password; |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 148 | public final TlsCertPolicy tlsCertPolicy; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 149 | |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 150 | // If the URIs in |urls| only contain IP addresses, this field can be used |
| 151 | // to indicate the hostname, which may be necessary for TLS (using the SNI |
| 152 | // extension). If |urls| itself contains the hostname, this isn't |
| 153 | // necessary. |
| 154 | public final String hostname; |
| 155 | |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 156 | // List of protocols to be used in the TLS ALPN extension. |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 157 | public final List<String> tlsAlpnProtocols; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 158 | |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 159 | // List of elliptic curves to be used in the TLS elliptic curves extension. |
| 160 | // Only curve names supported by OpenSSL should be used (eg. "P-256","X25519"). |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 161 | public final List<String> tlsEllipticCurves; |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 162 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 163 | /** Convenience constructor for STUN servers. */ |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 164 | @Deprecated |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 165 | public IceServer(String uri) { |
| 166 | this(uri, "", ""); |
| 167 | } |
| 168 | |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 169 | @Deprecated |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 170 | public IceServer(String uri, String username, String password) { |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 171 | this(uri, username, password, TlsCertPolicy.TLS_CERT_POLICY_SECURE); |
| 172 | } |
| 173 | |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 174 | @Deprecated |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 175 | public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy) { |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 176 | this(uri, username, password, tlsCertPolicy, ""); |
| 177 | } |
| 178 | |
Diogo Real | 05ea2b3 | 2017-08-31 00:12:58 -0700 | [diff] [blame] | 179 | @Deprecated |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 180 | public IceServer(String uri, String username, String password, TlsCertPolicy tlsCertPolicy, |
| 181 | String hostname) { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 182 | this(uri, Collections.singletonList(uri), username, password, tlsCertPolicy, hostname, null, |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 183 | null); |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 184 | } |
| 185 | |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 186 | private IceServer(String uri, List<String> urls, String username, String password, |
| 187 | TlsCertPolicy tlsCertPolicy, String hostname, List<String> tlsAlpnProtocols, |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 188 | List<String> tlsEllipticCurves) { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 189 | if (uri == null || urls == null || urls.isEmpty()) { |
| 190 | throw new IllegalArgumentException("uri == null || urls == null || urls.isEmpty()"); |
| 191 | } |
| 192 | for (String it : urls) { |
| 193 | if (it == null) { |
| 194 | throw new IllegalArgumentException("urls element is null: " + urls); |
| 195 | } |
| 196 | } |
| 197 | if (username == null) { |
| 198 | throw new IllegalArgumentException("username == null"); |
| 199 | } |
| 200 | if (password == null) { |
| 201 | throw new IllegalArgumentException("password == null"); |
| 202 | } |
| 203 | if (hostname == null) { |
| 204 | throw new IllegalArgumentException("hostname == null"); |
| 205 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 206 | this.uri = uri; |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 207 | this.urls = urls; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 208 | this.username = username; |
| 209 | this.password = password; |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 210 | this.tlsCertPolicy = tlsCertPolicy; |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 211 | this.hostname = hostname; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 212 | this.tlsAlpnProtocols = tlsAlpnProtocols; |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 213 | this.tlsEllipticCurves = tlsEllipticCurves; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 214 | } |
| 215 | |
Sami Kalliomäki | bde473e | 2017-10-30 13:34:41 +0100 | [diff] [blame] | 216 | @Override |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 217 | public String toString() { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 218 | return urls + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 219 | + "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]"; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | public static Builder builder(String uri) { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 223 | return new Builder(Collections.singletonList(uri)); |
| 224 | } |
| 225 | |
| 226 | public static Builder builder(List<String> urls) { |
| 227 | return new Builder(urls); |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | public static class Builder { |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 231 | @Nullable private final List<String> urls; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 232 | private String username = ""; |
| 233 | private String password = ""; |
| 234 | private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE; |
| 235 | private String hostname = ""; |
| 236 | private List<String> tlsAlpnProtocols; |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 237 | private List<String> tlsEllipticCurves; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 238 | |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 239 | private Builder(List<String> urls) { |
| 240 | if (urls == null || urls.isEmpty()) { |
| 241 | throw new IllegalArgumentException("urls == null || urls.isEmpty(): " + urls); |
| 242 | } |
| 243 | this.urls = urls; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | public Builder setUsername(String username) { |
| 247 | this.username = username; |
| 248 | return this; |
| 249 | } |
| 250 | |
| 251 | public Builder setPassword(String password) { |
| 252 | this.password = password; |
| 253 | return this; |
| 254 | } |
| 255 | |
| 256 | public Builder setTlsCertPolicy(TlsCertPolicy tlsCertPolicy) { |
| 257 | this.tlsCertPolicy = tlsCertPolicy; |
| 258 | return this; |
| 259 | } |
| 260 | |
| 261 | public Builder setHostname(String hostname) { |
| 262 | this.hostname = hostname; |
| 263 | return this; |
| 264 | } |
| 265 | |
| 266 | public Builder setTlsAlpnProtocols(List<String> tlsAlpnProtocols) { |
| 267 | this.tlsAlpnProtocols = tlsAlpnProtocols; |
| 268 | return this; |
| 269 | } |
| 270 | |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 271 | public Builder setTlsEllipticCurves(List<String> tlsEllipticCurves) { |
| 272 | this.tlsEllipticCurves = tlsEllipticCurves; |
| 273 | return this; |
| 274 | } |
| 275 | |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 276 | public IceServer createIceServer() { |
korniltsev.anatoly | 0ea0310 | 2017-09-11 06:41:38 -0700 | [diff] [blame] | 277 | return new IceServer(urls.get(0), urls, username, password, tlsCertPolicy, hostname, |
Sergey Silkin | 9c147dd | 2018-09-12 10:45:38 +0000 | [diff] [blame] | 278 | tlsAlpnProtocols, tlsEllipticCurves); |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 279 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 280 | } |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 281 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 282 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 283 | @CalledByNative("IceServer") |
| 284 | List<String> getUrls() { |
| 285 | return urls; |
| 286 | } |
| 287 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 288 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 289 | @CalledByNative("IceServer") |
| 290 | String getUsername() { |
| 291 | return username; |
| 292 | } |
| 293 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 294 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 295 | @CalledByNative("IceServer") |
| 296 | String getPassword() { |
| 297 | return password; |
| 298 | } |
| 299 | |
| 300 | @CalledByNative("IceServer") |
| 301 | TlsCertPolicy getTlsCertPolicy() { |
| 302 | return tlsCertPolicy; |
| 303 | } |
| 304 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 305 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 306 | @CalledByNative("IceServer") |
| 307 | String getHostname() { |
| 308 | return hostname; |
| 309 | } |
| 310 | |
| 311 | @CalledByNative("IceServer") |
| 312 | List<String> getTlsAlpnProtocols() { |
| 313 | return tlsAlpnProtocols; |
| 314 | } |
| 315 | |
| 316 | @CalledByNative("IceServer") |
| 317 | List<String> getTlsEllipticCurves() { |
| 318 | return tlsEllipticCurves; |
| 319 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 320 | } |
| 321 | |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 322 | /** Java version of PeerConnectionInterface.IceTransportsType */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 323 | public enum IceTransportsType { NONE, RELAY, NOHOST, ALL } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 324 | |
| 325 | /** Java version of PeerConnectionInterface.BundlePolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 326 | public enum BundlePolicy { BALANCED, MAXBUNDLE, MAXCOMPAT } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 327 | |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 328 | /** Java version of PeerConnectionInterface.RtcpMuxPolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 329 | public enum RtcpMuxPolicy { NEGOTIATE, REQUIRE } |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 330 | |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 331 | /** Java version of PeerConnectionInterface.TcpCandidatePolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 332 | public enum TcpCandidatePolicy { ENABLED, DISABLED } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 333 | |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 334 | /** Java version of PeerConnectionInterface.CandidateNetworkPolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 335 | public enum CandidateNetworkPolicy { ALL, LOW_COST } |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 336 | |
Qingsi Wang | 9a5c6f8 | 2018-02-01 10:38:40 -0800 | [diff] [blame] | 337 | // Keep in sync with webrtc/rtc_base/network_constants.h. |
| 338 | public enum AdapterType { |
| 339 | UNKNOWN, |
| 340 | ETHERNET, |
| 341 | WIFI, |
| 342 | CELLULAR, |
| 343 | VPN, |
| 344 | LOOPBACK, |
| 345 | } |
| 346 | |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 347 | /** Java version of rtc::KeyType */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 348 | public enum KeyType { RSA, ECDSA } |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 349 | |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 350 | /** Java version of PeerConnectionInterface.ContinualGatheringPolicy */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 351 | public enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY } |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 352 | |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 353 | /** Java version of rtc::IntervalRange */ |
| 354 | public static class IntervalRange { |
| 355 | private final int min; |
| 356 | private final int max; |
| 357 | |
| 358 | public IntervalRange(int min, int max) { |
| 359 | this.min = min; |
| 360 | this.max = max; |
| 361 | } |
| 362 | |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 363 | @CalledByNative("IntervalRange") |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 364 | public int getMin() { |
| 365 | return min; |
| 366 | } |
| 367 | |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 368 | @CalledByNative("IntervalRange") |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 369 | public int getMax() { |
| 370 | return max; |
| 371 | } |
| 372 | } |
| 373 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 374 | /** |
| 375 | * Java version of webrtc::SdpSemantics. |
| 376 | * |
| 377 | * Configure the SDP semantics used by this PeerConnection. Note that the |
| 378 | * WebRTC 1.0 specification requires UNIFIED_PLAN semantics. The |
| 379 | * RtpTransceiver API is only available with UNIFIED_PLAN semantics. |
| 380 | * |
| 381 | * <p>PLAN_B will cause PeerConnection to create offers and answers with at |
| 382 | * most one audio and one video m= section with multiple RtpSenders and |
| 383 | * RtpReceivers specified as multiple a=ssrc lines within the section. This |
| 384 | * will also cause PeerConnection to ignore all but the first m= section of |
| 385 | * the same media type. |
| 386 | * |
| 387 | * <p>UNIFIED_PLAN will cause PeerConnection to create offers and answers with |
| 388 | * multiple m= sections where each m= section maps to one RtpSender and one |
| 389 | * RtpReceiver (an RtpTransceiver), either both audio or both video. This |
| 390 | * will also cause PeerConnection to ignore all but the first a=ssrc lines |
| 391 | * that form a Plan B stream. |
| 392 | * |
| 393 | * <p>For users who wish to send multiple audio/video streams and need to stay |
| 394 | * interoperable with legacy WebRTC implementations, specify PLAN_B. |
| 395 | * |
| 396 | * <p>For users who wish to send multiple audio/video streams and/or wish to |
| 397 | * use the new RtpTransceiver API, specify UNIFIED_PLAN. |
| 398 | */ |
| 399 | public enum SdpSemantics { PLAN_B, UNIFIED_PLAN } |
| 400 | |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 401 | /** Java version of PeerConnectionInterface.RTCConfiguration */ |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 402 | // TODO(qingsi): Resolve the naming inconsistency of fields with/without units. |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 403 | public static class RTCConfiguration { |
| 404 | public IceTransportsType iceTransportsType; |
| 405 | public List<IceServer> iceServers; |
| 406 | public BundlePolicy bundlePolicy; |
Michael Iedema | 0213786 | 2018-10-09 15:30:01 +0200 | [diff] [blame] | 407 | @Nullable public RtcCertificatePem certificate; |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 408 | public RtcpMuxPolicy rtcpMuxPolicy; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 409 | public TcpCandidatePolicy tcpCandidatePolicy; |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 410 | public CandidateNetworkPolicy candidateNetworkPolicy; |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 411 | public int audioJitterBufferMaxPackets; |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 412 | public boolean audioJitterBufferFastAccelerate; |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 413 | public int iceConnectionReceivingTimeout; |
Honghai Zhang | 381b421 | 2015-12-04 12:24:03 -0800 | [diff] [blame] | 414 | public int iceBackupCandidatePairPingInterval; |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 415 | public KeyType keyType; |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 416 | public ContinualGatheringPolicy continualGatheringPolicy; |
deadbeef | be0c96f | 2016-05-18 16:20:14 -0700 | [diff] [blame] | 417 | public int iceCandidatePoolSize; |
Honghai Zhang | d78ecf7 | 2016-07-01 14:40:40 -0700 | [diff] [blame] | 418 | public boolean pruneTurnPorts; |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 419 | public boolean presumeWritableWhenFullyRelayed; |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 420 | // The following fields define intervals in milliseconds at which ICE |
| 421 | // connectivity checks are sent. |
| 422 | // |
| 423 | // We consider ICE is "strongly connected" for an agent when there is at |
| 424 | // least one candidate pair that currently succeeds in connectivity check |
| 425 | // from its direction i.e. sending a ping and receives a ping response, AND |
| 426 | // all candidate pairs have sent a minimum number of pings for connectivity |
| 427 | // (this number is implementation-specific). Otherwise, ICE is considered in |
| 428 | // "weak connectivity". |
| 429 | // |
| 430 | // Note that the above notion of strong and weak connectivity is not defined |
| 431 | // in RFC 5245, and they apply to our current ICE implementation only. |
| 432 | // |
| 433 | // 1) iceCheckIntervalStrongConnectivityMs defines the interval applied to |
| 434 | // ALL candidate pairs when ICE is strongly connected, |
| 435 | // 2) iceCheckIntervalWeakConnectivityMs defines the counterpart for ALL |
| 436 | // pairs when ICE is weakly connected, and |
| 437 | // 3) iceCheckMinInterval defines the minimal interval (equivalently the |
| 438 | // maximum rate) that overrides the above two intervals when either of them |
| 439 | // is less. |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 440 | @Nullable public Integer iceCheckIntervalStrongConnectivityMs; |
| 441 | @Nullable public Integer iceCheckIntervalWeakConnectivityMs; |
| 442 | @Nullable public Integer iceCheckMinInterval; |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 443 | // The time period in milliseconds for which a candidate pair must wait for response to |
| 444 | // connectivitiy checks before it becomes unwritable. |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 445 | @Nullable public Integer iceUnwritableTimeMs; |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 446 | // The minimum number of connectivity checks that a candidate pair must sent without receiving |
| 447 | // response before it becomes unwritable. |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 448 | @Nullable public Integer iceUnwritableMinChecks; |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 449 | // The interval in milliseconds at which STUN candidates will resend STUN binding requests |
| 450 | // to keep NAT bindings open. |
| 451 | // The default value in the implementation is used if this field is null. |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 452 | @Nullable public Integer stunCandidateKeepaliveIntervalMs; |
zhihuang | b09b3f9 | 2017-03-07 14:40:51 -0800 | [diff] [blame] | 453 | public boolean disableIPv6OnWifi; |
deadbeef | 28e2919 | 2017-07-27 09:14:38 -0700 | [diff] [blame] | 454 | // By default, PeerConnection will use a limited number of IPv6 network |
| 455 | // interfaces, in order to avoid too many ICE candidate pairs being created |
| 456 | // and delaying ICE completion. |
| 457 | // |
| 458 | // Can be set to Integer.MAX_VALUE to effectively disable the limit. |
| 459 | public int maxIPv6Networks; |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 460 | @Nullable public IntervalRange iceRegatherIntervalRange; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 461 | |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 462 | // These values will be overridden by MediaStream constraints if deprecated constraints-based |
| 463 | // create peerconnection interface is used. |
| 464 | public boolean disableIpv6; |
| 465 | public boolean enableDscp; |
| 466 | public boolean enableCpuOveruseDetection; |
| 467 | public boolean enableRtpDataChannel; |
| 468 | public boolean suspendBelowMinBitrate; |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 469 | @Nullable public Integer screencastMinBitrate; |
| 470 | @Nullable public Boolean combinedAudioVideoBwe; |
| 471 | @Nullable public Boolean enableDtlsSrtp; |
Qingsi Wang | 9a5c6f8 | 2018-02-01 10:38:40 -0800 | [diff] [blame] | 472 | // Use "Unknown" to represent no preference of adapter types, not the |
| 473 | // preference of adapters of unknown types. |
| 474 | public AdapterType networkPreference; |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 475 | public SdpSemantics sdpSemantics; |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 476 | |
Jonas Oreland | bdcee28 | 2017-10-10 14:01:40 +0200 | [diff] [blame] | 477 | // This is an optional wrapper for the C++ webrtc::TurnCustomizer. |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 478 | @Nullable public TurnCustomizer turnCustomizer; |
Jonas Oreland | bdcee28 | 2017-10-10 14:01:40 +0200 | [diff] [blame] | 479 | |
Zhi Huang | b57e169 | 2018-06-12 11:41:11 -0700 | [diff] [blame] | 480 | // Actively reset the SRTP parameters whenever the DTLS transports underneath are reset for |
| 481 | // every offer/answer negotiation.This is only intended to be a workaround for crbug.com/835958 |
| 482 | public boolean activeResetSrtpParams; |
| 483 | |
Piotr (Peter) Slatala | 09beff2 | 2018-10-17 07:22:40 -0700 | [diff] [blame] | 484 | /* |
| 485 | * Experimental flag that enables a use of media transport. If this is true, the media transport |
| 486 | * factory MUST be provided to the PeerConnectionFactory. |
| 487 | */ |
| 488 | public boolean useMediaTransport; |
| 489 | |
Bjorn Mellem | a9bbd86 | 2018-11-02 09:07:48 -0700 | [diff] [blame] | 490 | /* |
| 491 | * Experimental flag that enables a use of media transport for data channels. If this is true, |
| 492 | * the media transport factory MUST be provided to the PeerConnectionFactory. |
| 493 | */ |
| 494 | public boolean useMediaTransportForDataChannels; |
| 495 | |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 496 | /** |
| 497 | * Defines advanced optional cryptographic settings related to SRTP and |
| 498 | * frame encryption for native WebRTC. Setting this will overwrite any |
| 499 | * options set through the PeerConnectionFactory (which is deprecated). |
| 500 | */ |
| 501 | @Nullable public CryptoOptions cryptoOptions; |
| 502 | |
deadbeef | 28e2919 | 2017-07-27 09:14:38 -0700 | [diff] [blame] | 503 | // TODO(deadbeef): Instead of duplicating the defaults here, we should do |
| 504 | // something to pick up the defaults from C++. The Objective-C equivalent |
| 505 | // of RTCConfiguration does that. |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 506 | public RTCConfiguration(List<IceServer> iceServers) { |
| 507 | iceTransportsType = IceTransportsType.ALL; |
| 508 | bundlePolicy = BundlePolicy.BALANCED; |
zhihuang | 4dfb8ce | 2016-11-23 10:30:12 -0800 | [diff] [blame] | 509 | rtcpMuxPolicy = RtcpMuxPolicy.REQUIRE; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 510 | tcpCandidatePolicy = TcpCandidatePolicy.ENABLED; |
Sami Kalliomäki | 9828beb | 2017-10-26 16:21:22 +0200 | [diff] [blame] | 511 | candidateNetworkPolicy = CandidateNetworkPolicy.ALL; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 512 | this.iceServers = iceServers; |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 513 | audioJitterBufferMaxPackets = 50; |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 514 | audioJitterBufferFastAccelerate = false; |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 515 | iceConnectionReceivingTimeout = -1; |
Honghai Zhang | 381b421 | 2015-12-04 12:24:03 -0800 | [diff] [blame] | 516 | iceBackupCandidatePairPingInterval = -1; |
glaznev | 97579a4 | 2015-09-01 11:31:27 -0700 | [diff] [blame] | 517 | keyType = KeyType.ECDSA; |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 518 | continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE; |
deadbeef | be0c96f | 2016-05-18 16:20:14 -0700 | [diff] [blame] | 519 | iceCandidatePoolSize = 0; |
Honghai Zhang | d78ecf7 | 2016-07-01 14:40:40 -0700 | [diff] [blame] | 520 | pruneTurnPorts = false; |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 521 | presumeWritableWhenFullyRelayed = false; |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 522 | iceCheckIntervalStrongConnectivityMs = null; |
| 523 | iceCheckIntervalWeakConnectivityMs = null; |
skvlad | 5107246 | 2017-02-02 11:50:14 -0800 | [diff] [blame] | 524 | iceCheckMinInterval = null; |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 525 | iceUnwritableTimeMs = null; |
| 526 | iceUnwritableMinChecks = null; |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 527 | stunCandidateKeepaliveIntervalMs = null; |
zhihuang | b09b3f9 | 2017-03-07 14:40:51 -0800 | [diff] [blame] | 528 | disableIPv6OnWifi = false; |
deadbeef | 28e2919 | 2017-07-27 09:14:38 -0700 | [diff] [blame] | 529 | maxIPv6Networks = 5; |
Steve Anton | d960a0c | 2017-07-17 12:33:07 -0700 | [diff] [blame] | 530 | iceRegatherIntervalRange = null; |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 531 | disableIpv6 = false; |
| 532 | enableDscp = false; |
| 533 | enableCpuOveruseDetection = true; |
| 534 | enableRtpDataChannel = false; |
| 535 | suspendBelowMinBitrate = false; |
| 536 | screencastMinBitrate = null; |
| 537 | combinedAudioVideoBwe = null; |
| 538 | enableDtlsSrtp = null; |
Qingsi Wang | 9a5c6f8 | 2018-02-01 10:38:40 -0800 | [diff] [blame] | 539 | networkPreference = AdapterType.UNKNOWN; |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 540 | sdpSemantics = SdpSemantics.PLAN_B; |
Zhi Huang | b57e169 | 2018-06-12 11:41:11 -0700 | [diff] [blame] | 541 | activeResetSrtpParams = false; |
Piotr (Peter) Slatala | 09beff2 | 2018-10-17 07:22:40 -0700 | [diff] [blame] | 542 | useMediaTransport = false; |
Bjorn Mellem | a9bbd86 | 2018-11-02 09:07:48 -0700 | [diff] [blame] | 543 | useMediaTransportForDataChannels = false; |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 544 | cryptoOptions = null; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 545 | } |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 546 | |
| 547 | @CalledByNative("RTCConfiguration") |
| 548 | IceTransportsType getIceTransportsType() { |
| 549 | return iceTransportsType; |
| 550 | } |
| 551 | |
| 552 | @CalledByNative("RTCConfiguration") |
| 553 | List<IceServer> getIceServers() { |
| 554 | return iceServers; |
| 555 | } |
| 556 | |
| 557 | @CalledByNative("RTCConfiguration") |
| 558 | BundlePolicy getBundlePolicy() { |
| 559 | return bundlePolicy; |
| 560 | } |
| 561 | |
Michael Iedema | 0213786 | 2018-10-09 15:30:01 +0200 | [diff] [blame] | 562 | @Nullable |
| 563 | @CalledByNative("RTCConfiguration") |
| 564 | RtcCertificatePem getCertificate() { |
| 565 | return certificate; |
| 566 | } |
| 567 | |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 568 | @CalledByNative("RTCConfiguration") |
| 569 | RtcpMuxPolicy getRtcpMuxPolicy() { |
| 570 | return rtcpMuxPolicy; |
| 571 | } |
| 572 | |
| 573 | @CalledByNative("RTCConfiguration") |
| 574 | TcpCandidatePolicy getTcpCandidatePolicy() { |
| 575 | return tcpCandidatePolicy; |
| 576 | } |
| 577 | |
| 578 | @CalledByNative("RTCConfiguration") |
| 579 | CandidateNetworkPolicy getCandidateNetworkPolicy() { |
| 580 | return candidateNetworkPolicy; |
| 581 | } |
| 582 | |
| 583 | @CalledByNative("RTCConfiguration") |
| 584 | int getAudioJitterBufferMaxPackets() { |
| 585 | return audioJitterBufferMaxPackets; |
| 586 | } |
| 587 | |
| 588 | @CalledByNative("RTCConfiguration") |
| 589 | boolean getAudioJitterBufferFastAccelerate() { |
| 590 | return audioJitterBufferFastAccelerate; |
| 591 | } |
| 592 | |
| 593 | @CalledByNative("RTCConfiguration") |
| 594 | int getIceConnectionReceivingTimeout() { |
| 595 | return iceConnectionReceivingTimeout; |
| 596 | } |
| 597 | |
| 598 | @CalledByNative("RTCConfiguration") |
| 599 | int getIceBackupCandidatePairPingInterval() { |
| 600 | return iceBackupCandidatePairPingInterval; |
| 601 | } |
| 602 | |
| 603 | @CalledByNative("RTCConfiguration") |
| 604 | KeyType getKeyType() { |
| 605 | return keyType; |
| 606 | } |
| 607 | |
| 608 | @CalledByNative("RTCConfiguration") |
| 609 | ContinualGatheringPolicy getContinualGatheringPolicy() { |
| 610 | return continualGatheringPolicy; |
| 611 | } |
| 612 | |
| 613 | @CalledByNative("RTCConfiguration") |
| 614 | int getIceCandidatePoolSize() { |
| 615 | return iceCandidatePoolSize; |
| 616 | } |
| 617 | |
| 618 | @CalledByNative("RTCConfiguration") |
| 619 | boolean getPruneTurnPorts() { |
| 620 | return pruneTurnPorts; |
| 621 | } |
| 622 | |
| 623 | @CalledByNative("RTCConfiguration") |
| 624 | boolean getPresumeWritableWhenFullyRelayed() { |
| 625 | return presumeWritableWhenFullyRelayed; |
| 626 | } |
| 627 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 628 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 629 | @CalledByNative("RTCConfiguration") |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 630 | Integer getIceCheckIntervalStrongConnectivity() { |
| 631 | return iceCheckIntervalStrongConnectivityMs; |
| 632 | } |
| 633 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 634 | @Nullable |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 635 | @CalledByNative("RTCConfiguration") |
| 636 | Integer getIceCheckIntervalWeakConnectivity() { |
| 637 | return iceCheckIntervalWeakConnectivityMs; |
| 638 | } |
| 639 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 640 | @Nullable |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 641 | @CalledByNative("RTCConfiguration") |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 642 | Integer getIceCheckMinInterval() { |
| 643 | return iceCheckMinInterval; |
| 644 | } |
| 645 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 646 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 647 | @CalledByNative("RTCConfiguration") |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 648 | Integer getIceUnwritableTimeout() { |
| 649 | return iceUnwritableTimeMs; |
| 650 | } |
| 651 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 652 | @Nullable |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 653 | @CalledByNative("RTCConfiguration") |
| 654 | Integer getIceUnwritableMinChecks() { |
| 655 | return iceUnwritableMinChecks; |
| 656 | } |
| 657 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 658 | @Nullable |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 659 | @CalledByNative("RTCConfiguration") |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 660 | Integer getStunCandidateKeepaliveInterval() { |
| 661 | return stunCandidateKeepaliveIntervalMs; |
| 662 | } |
| 663 | |
| 664 | @CalledByNative("RTCConfiguration") |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 665 | boolean getDisableIPv6OnWifi() { |
| 666 | return disableIPv6OnWifi; |
| 667 | } |
| 668 | |
| 669 | @CalledByNative("RTCConfiguration") |
| 670 | int getMaxIPv6Networks() { |
| 671 | return maxIPv6Networks; |
| 672 | } |
| 673 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 674 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 675 | @CalledByNative("RTCConfiguration") |
| 676 | IntervalRange getIceRegatherIntervalRange() { |
| 677 | return iceRegatherIntervalRange; |
| 678 | } |
| 679 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 680 | @Nullable |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 681 | @CalledByNative("RTCConfiguration") |
| 682 | TurnCustomizer getTurnCustomizer() { |
| 683 | return turnCustomizer; |
| 684 | } |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 685 | |
| 686 | @CalledByNative("RTCConfiguration") |
| 687 | boolean getDisableIpv6() { |
| 688 | return disableIpv6; |
| 689 | } |
| 690 | |
| 691 | @CalledByNative("RTCConfiguration") |
| 692 | boolean getEnableDscp() { |
| 693 | return enableDscp; |
| 694 | } |
| 695 | |
| 696 | @CalledByNative("RTCConfiguration") |
| 697 | boolean getEnableCpuOveruseDetection() { |
| 698 | return enableCpuOveruseDetection; |
| 699 | } |
| 700 | |
| 701 | @CalledByNative("RTCConfiguration") |
| 702 | boolean getEnableRtpDataChannel() { |
| 703 | return enableRtpDataChannel; |
| 704 | } |
| 705 | |
| 706 | @CalledByNative("RTCConfiguration") |
| 707 | boolean getSuspendBelowMinBitrate() { |
| 708 | return suspendBelowMinBitrate; |
| 709 | } |
| 710 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 711 | @Nullable |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 712 | @CalledByNative("RTCConfiguration") |
| 713 | Integer getScreencastMinBitrate() { |
| 714 | return screencastMinBitrate; |
| 715 | } |
| 716 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 717 | @Nullable |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 718 | @CalledByNative("RTCConfiguration") |
| 719 | Boolean getCombinedAudioVideoBwe() { |
| 720 | return combinedAudioVideoBwe; |
| 721 | } |
| 722 | |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 723 | @Nullable |
Sami Kalliomäki | e8b26cd | 2017-12-19 12:51:53 +0100 | [diff] [blame] | 724 | @CalledByNative("RTCConfiguration") |
| 725 | Boolean getEnableDtlsSrtp() { |
| 726 | return enableDtlsSrtp; |
| 727 | } |
Qingsi Wang | 9a5c6f8 | 2018-02-01 10:38:40 -0800 | [diff] [blame] | 728 | |
| 729 | @CalledByNative("RTCConfiguration") |
| 730 | AdapterType getNetworkPreference() { |
| 731 | return networkPreference; |
| 732 | } |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 733 | |
| 734 | @CalledByNative("RTCConfiguration") |
| 735 | SdpSemantics getSdpSemantics() { |
| 736 | return sdpSemantics; |
| 737 | } |
Zhi Huang | b57e169 | 2018-06-12 11:41:11 -0700 | [diff] [blame] | 738 | |
| 739 | @CalledByNative("RTCConfiguration") |
| 740 | boolean getActiveResetSrtpParams() { |
| 741 | return activeResetSrtpParams; |
| 742 | } |
Piotr (Peter) Slatala | 09beff2 | 2018-10-17 07:22:40 -0700 | [diff] [blame] | 743 | |
| 744 | @CalledByNative("RTCConfiguration") |
| 745 | boolean getUseMediaTransport() { |
| 746 | return useMediaTransport; |
| 747 | } |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 748 | |
Bjorn Mellem | a9bbd86 | 2018-11-02 09:07:48 -0700 | [diff] [blame] | 749 | @CalledByNative("RTCConfiguration") |
| 750 | boolean getUseMediaTransportForDataChannels() { |
| 751 | return useMediaTransportForDataChannels; |
| 752 | } |
| 753 | |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 754 | @Nullable |
| 755 | @CalledByNative("RTCConfiguration") |
| 756 | CryptoOptions getCryptoOptions() { |
| 757 | return cryptoOptions; |
| 758 | } |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 759 | }; |
| 760 | |
Magnus Jedvert | 6062f37 | 2017-11-16 16:53:12 +0100 | [diff] [blame] | 761 | private final List<MediaStream> localStreams = new ArrayList<>(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 762 | private final long nativePeerConnection; |
Magnus Jedvert | 6062f37 | 2017-11-16 16:53:12 +0100 | [diff] [blame] | 763 | private List<RtpSender> senders = new ArrayList<>(); |
| 764 | private List<RtpReceiver> receivers = new ArrayList<>(); |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 765 | private List<RtpTransceiver> transceivers = new ArrayList<>(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 766 | |
Sami Kalliomäki | 1ece1ed | 2017-12-20 11:59:22 +0100 | [diff] [blame] | 767 | /** |
| 768 | * Wraps a PeerConnection created by the factory. Can be used by clients that want to implement |
| 769 | * their PeerConnection creation in JNI. |
| 770 | */ |
| 771 | public PeerConnection(NativePeerConnectionFactory factory) { |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 772 | this(factory.createNativePeerConnection()); |
Sami Kalliomäki | 1ece1ed | 2017-12-20 11:59:22 +0100 | [diff] [blame] | 773 | } |
| 774 | |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 775 | PeerConnection(long nativePeerConnection) { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 776 | this.nativePeerConnection = nativePeerConnection; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 777 | } |
| 778 | |
| 779 | // JsepInterface. |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 780 | public SessionDescription getLocalDescription() { |
| 781 | return nativeGetLocalDescription(); |
| 782 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 783 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 784 | public SessionDescription getRemoteDescription() { |
| 785 | return nativeGetRemoteDescription(); |
| 786 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 787 | |
Michael Iedema | 0213786 | 2018-10-09 15:30:01 +0200 | [diff] [blame] | 788 | public RtcCertificatePem getCertificate() { |
| 789 | return nativeGetCertificate(); |
| 790 | } |
| 791 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 792 | public DataChannel createDataChannel(String label, DataChannel.Init init) { |
| 793 | return nativeCreateDataChannel(label, init); |
| 794 | } |
henrike@webrtc.org | 723d683 | 2013-07-12 16:04:50 +0000 | [diff] [blame] | 795 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 796 | public void createOffer(SdpObserver observer, MediaConstraints constraints) { |
| 797 | nativeCreateOffer(observer, constraints); |
| 798 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 799 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 800 | public void createAnswer(SdpObserver observer, MediaConstraints constraints) { |
| 801 | nativeCreateAnswer(observer, constraints); |
| 802 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 803 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 804 | public void setLocalDescription(SdpObserver observer, SessionDescription sdp) { |
| 805 | nativeSetLocalDescription(observer, sdp); |
| 806 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 807 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 808 | public void setRemoteDescription(SdpObserver observer, SessionDescription sdp) { |
| 809 | nativeSetRemoteDescription(observer, sdp); |
| 810 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 811 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 812 | /** |
| 813 | * Enables/disables playout of received audio streams. Enabled by default. |
| 814 | * |
| 815 | * Note that even if playout is enabled, streams will only be played out if |
| 816 | * the appropriate SDP is also applied. The main purpose of this API is to |
| 817 | * be able to control the exact time when audio playout starts. |
| 818 | */ |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 819 | public void setAudioPlayout(boolean playout) { |
| 820 | nativeSetAudioPlayout(playout); |
| 821 | } |
henrika | 5f6bf24 | 2017-11-01 11:06:56 +0100 | [diff] [blame] | 822 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 823 | /** |
| 824 | * Enables/disables recording of transmitted audio streams. Enabled by default. |
| 825 | * |
| 826 | * Note that even if recording is enabled, streams will only be recorded if |
| 827 | * the appropriate SDP is also applied. The main purpose of this API is to |
| 828 | * be able to control the exact time when audio recording starts. |
| 829 | */ |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 830 | public void setAudioRecording(boolean recording) { |
| 831 | nativeSetAudioRecording(recording); |
| 832 | } |
henrika | 5f6bf24 | 2017-11-01 11:06:56 +0100 | [diff] [blame] | 833 | |
deadbeef | 5d0b6d8 | 2017-01-09 16:05:28 -0800 | [diff] [blame] | 834 | public boolean setConfiguration(RTCConfiguration config) { |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 835 | return nativeSetConfiguration(config); |
deadbeef | 5d0b6d8 | 2017-01-09 16:05:28 -0800 | [diff] [blame] | 836 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 837 | |
| 838 | public boolean addIceCandidate(IceCandidate candidate) { |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 839 | return nativeAddIceCandidate(candidate.sdpMid, candidate.sdpMLineIndex, candidate.sdp); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 840 | } |
| 841 | |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 842 | public boolean removeIceCandidates(final IceCandidate[] candidates) { |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 843 | return nativeRemoveIceCandidates(candidates); |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 844 | } |
| 845 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 846 | /** |
| 847 | * Adds a new MediaStream to be sent on this peer connection. |
| 848 | * Note: This method is not supported with SdpSemantics.UNIFIED_PLAN. Please |
| 849 | * use addTrack instead. |
| 850 | */ |
perkj@webrtc.org | c2dd5ee | 2014-11-04 11:31:29 +0000 | [diff] [blame] | 851 | public boolean addStream(MediaStream stream) { |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 852 | boolean ret = nativeAddLocalStream(stream.getNativeMediaStream()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 853 | if (!ret) { |
| 854 | return false; |
| 855 | } |
| 856 | localStreams.add(stream); |
| 857 | return true; |
| 858 | } |
| 859 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 860 | /** |
| 861 | * Removes the given media stream from this peer connection. |
| 862 | * This method is not supported with SdpSemantics.UNIFIED_PLAN. Please use |
| 863 | * removeTrack instead. |
| 864 | */ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 865 | public void removeStream(MediaStream stream) { |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 866 | nativeRemoveLocalStream(stream.getNativeMediaStream()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 867 | localStreams.remove(stream); |
| 868 | } |
| 869 | |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 870 | /** |
| 871 | * Creates an RtpSender without a track. |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 872 | * |
| 873 | * <p>This method allows an application to cause the PeerConnection to negotiate |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 874 | * sending/receiving a specific media type, but without having a track to |
| 875 | * send yet. |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 876 | * |
| 877 | * <p>When the application does want to begin sending a track, it can call |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 878 | * RtpSender.setTrack, which doesn't require any additional SDP negotiation. |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 879 | * |
| 880 | * <p>Example use: |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 881 | * <pre> |
| 882 | * {@code |
| 883 | * audioSender = pc.createSender("audio", "stream1"); |
| 884 | * videoSender = pc.createSender("video", "stream1"); |
| 885 | * // Do normal SDP offer/answer, which will kick off ICE/DTLS and negotiate |
| 886 | * // media parameters.... |
| 887 | * // Later, when the endpoint is ready to actually begin sending: |
| 888 | * audioSender.setTrack(audioTrack, false); |
| 889 | * videoSender.setTrack(videoTrack, false); |
| 890 | * } |
| 891 | * </pre> |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 892 | * <p>Note: This corresponds most closely to "addTransceiver" in the official |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 893 | * WebRTC API, in that it creates a sender without a track. It was |
| 894 | * implemented before addTransceiver because it provides useful |
| 895 | * functionality, and properly implementing transceivers would have required |
| 896 | * a great deal more work. |
| 897 | * |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 898 | * <p>Note: This is only available with SdpSemantics.PLAN_B specified. Please use |
| 899 | * addTransceiver instead. |
| 900 | * |
deadbeef | 7a24688 | 2017-08-09 08:40:10 -0700 | [diff] [blame] | 901 | * @param kind Corresponds to MediaStreamTrack kinds (must be "audio" or |
| 902 | * "video"). |
| 903 | * @param stream_id The ID of the MediaStream that this sender's track will |
| 904 | * be associated with when SDP is applied to the remote |
| 905 | * PeerConnection. If createSender is used to create an |
| 906 | * audio and video sender that should be synchronized, they |
| 907 | * should use the same stream ID. |
| 908 | * @return A new RtpSender object if successful, or null otherwise. |
| 909 | */ |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 910 | public RtpSender createSender(String kind, String stream_id) { |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 911 | RtpSender newSender = nativeCreateSender(kind, stream_id); |
| 912 | if (newSender != null) { |
| 913 | senders.add(newSender); |
deadbeef | ee524f7 | 2015-12-02 11:27:40 -0800 | [diff] [blame] | 914 | } |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 915 | return newSender; |
deadbeef | ee524f7 | 2015-12-02 11:27:40 -0800 | [diff] [blame] | 916 | } |
| 917 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 918 | /** |
| 919 | * Gets all RtpSenders associated with this peer connection. |
| 920 | * Note that calling getSenders will dispose of the senders previously |
| 921 | * returned. |
| 922 | */ |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 923 | public List<RtpSender> getSenders() { |
| 924 | for (RtpSender sender : senders) { |
| 925 | sender.dispose(); |
| 926 | } |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 927 | senders = nativeGetSenders(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 928 | return Collections.unmodifiableList(senders); |
| 929 | } |
| 930 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 931 | /** |
| 932 | * Gets all RtpReceivers associated with this peer connection. |
| 933 | * Note that calling getReceivers will dispose of the receivers previously |
| 934 | * returned. |
| 935 | */ |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 936 | public List<RtpReceiver> getReceivers() { |
| 937 | for (RtpReceiver receiver : receivers) { |
| 938 | receiver.dispose(); |
| 939 | } |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 940 | receivers = nativeGetReceivers(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 941 | return Collections.unmodifiableList(receivers); |
| 942 | } |
| 943 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 944 | /** |
| 945 | * Gets all RtpTransceivers associated with this peer connection. |
| 946 | * Note that calling getTransceivers will dispose of the transceivers previously |
| 947 | * returned. |
| 948 | * Note: This is only available with SdpSemantics.UNIFIED_PLAN specified. |
| 949 | */ |
| 950 | public List<RtpTransceiver> getTransceivers() { |
| 951 | for (RtpTransceiver transceiver : transceivers) { |
| 952 | transceiver.dispose(); |
| 953 | } |
| 954 | transceivers = nativeGetTransceivers(); |
| 955 | return Collections.unmodifiableList(transceivers); |
| 956 | } |
| 957 | |
| 958 | /** |
| 959 | * Adds a new media stream track to be sent on this peer connection, and returns |
| 960 | * the newly created RtpSender. If streamIds are specified, the RtpSender will |
| 961 | * be associated with the streams specified in the streamIds list. |
| 962 | * |
| 963 | * @throws IllegalStateException if an error accors in C++ addTrack. |
| 964 | * An error can occur if: |
| 965 | * - A sender already exists for the track. |
| 966 | * - The peer connection is closed. |
| 967 | */ |
| 968 | public RtpSender addTrack(MediaStreamTrack track) { |
| 969 | return addTrack(track, Collections.emptyList()); |
| 970 | } |
| 971 | |
| 972 | public RtpSender addTrack(MediaStreamTrack track, List<String> streamIds) { |
| 973 | if (track == null || streamIds == null) { |
| 974 | throw new NullPointerException("No MediaStreamTrack specified in addTrack."); |
| 975 | } |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 976 | RtpSender newSender = nativeAddTrack(track.getNativeMediaStreamTrack(), streamIds); |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 977 | if (newSender == null) { |
| 978 | throw new IllegalStateException("C++ addTrack failed."); |
| 979 | } |
| 980 | senders.add(newSender); |
| 981 | return newSender; |
| 982 | } |
| 983 | |
| 984 | /** |
| 985 | * Stops sending media from sender. The sender will still appear in getSenders. Future |
| 986 | * calls to createOffer will mark the m section for the corresponding transceiver as |
| 987 | * receive only or inactive, as defined in JSEP. Returns true on success. |
| 988 | */ |
| 989 | public boolean removeTrack(RtpSender sender) { |
| 990 | if (sender == null) { |
| 991 | throw new NullPointerException("No RtpSender specified for removeTrack."); |
| 992 | } |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 993 | return nativeRemoveTrack(sender.getNativeRtpSender()); |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 994 | } |
| 995 | |
| 996 | /** |
| 997 | * Creates a new RtpTransceiver and adds it to the set of transceivers. Adding a |
| 998 | * transceiver will cause future calls to CreateOffer to add a media description |
| 999 | * for the corresponding transceiver. |
| 1000 | * |
| 1001 | * <p>The initial value of |mid| in the returned transceiver is null. Setting a |
| 1002 | * new session description may change it to a non-null value. |
| 1003 | * |
| 1004 | * <p>https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver |
| 1005 | * |
| 1006 | * <p>If a MediaStreamTrack is specified then a transceiver will be added with a |
| 1007 | * sender set to transmit the given track. The kind |
| 1008 | * of the transceiver (and sender/receiver) will be derived from the kind of |
| 1009 | * the track. |
| 1010 | * |
| 1011 | * <p>If MediaType is specified then a transceiver will be added based upon that type. |
| 1012 | * This can be either MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO. |
| 1013 | * |
| 1014 | * <p>Optionally, an RtpTransceiverInit structure can be specified to configure |
| 1015 | * the transceiver from construction. If not specified, the transceiver will |
| 1016 | * default to having a direction of kSendRecv and not be part of any streams. |
| 1017 | * |
| 1018 | * <p>Note: These methods are only available with SdpSemantics.UNIFIED_PLAN specified. |
| 1019 | * @throws IllegalStateException if an error accors in C++ addTransceiver |
| 1020 | */ |
| 1021 | public RtpTransceiver addTransceiver(MediaStreamTrack track) { |
| 1022 | return addTransceiver(track, new RtpTransceiver.RtpTransceiverInit()); |
| 1023 | } |
| 1024 | |
| 1025 | public RtpTransceiver addTransceiver( |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 1026 | MediaStreamTrack track, @Nullable RtpTransceiver.RtpTransceiverInit init) { |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1027 | if (track == null) { |
| 1028 | throw new NullPointerException("No MediaStreamTrack specified for addTransceiver."); |
| 1029 | } |
| 1030 | if (init == null) { |
| 1031 | init = new RtpTransceiver.RtpTransceiverInit(); |
| 1032 | } |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 1033 | RtpTransceiver newTransceiver = |
| 1034 | nativeAddTransceiverWithTrack(track.getNativeMediaStreamTrack(), init); |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1035 | if (newTransceiver == null) { |
| 1036 | throw new IllegalStateException("C++ addTransceiver failed."); |
| 1037 | } |
| 1038 | transceivers.add(newTransceiver); |
| 1039 | return newTransceiver; |
| 1040 | } |
| 1041 | |
| 1042 | public RtpTransceiver addTransceiver(MediaStreamTrack.MediaType mediaType) { |
| 1043 | return addTransceiver(mediaType, new RtpTransceiver.RtpTransceiverInit()); |
| 1044 | } |
| 1045 | |
| 1046 | public RtpTransceiver addTransceiver( |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 1047 | MediaStreamTrack.MediaType mediaType, @Nullable RtpTransceiver.RtpTransceiverInit init) { |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1048 | if (mediaType == null) { |
| 1049 | throw new NullPointerException("No MediaType specified for addTransceiver."); |
| 1050 | } |
| 1051 | if (init == null) { |
| 1052 | init = new RtpTransceiver.RtpTransceiverInit(); |
| 1053 | } |
| 1054 | RtpTransceiver newTransceiver = nativeAddTransceiverOfType(mediaType, init); |
| 1055 | if (newTransceiver == null) { |
| 1056 | throw new IllegalStateException("C++ addTransceiver failed."); |
| 1057 | } |
| 1058 | transceivers.add(newTransceiver); |
| 1059 | return newTransceiver; |
| 1060 | } |
| 1061 | |
deadbeef | 8221587 | 2017-04-18 10:27:51 -0700 | [diff] [blame] | 1062 | // Older, non-standard implementation of getStats. |
| 1063 | @Deprecated |
Sami Kalliomäki | e7592d8 | 2018-03-22 13:32:44 +0100 | [diff] [blame] | 1064 | public boolean getStats(StatsObserver observer, @Nullable MediaStreamTrack track) { |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 1065 | return nativeOldGetStats(observer, (track == null) ? 0 : track.getNativeMediaStreamTrack()); |
deadbeef | 8221587 | 2017-04-18 10:27:51 -0700 | [diff] [blame] | 1066 | } |
| 1067 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1068 | /** |
| 1069 | * Gets stats using the new stats collection API, see webrtc/api/stats/. These |
| 1070 | * will replace old stats collection API when the new API has matured enough. |
| 1071 | */ |
deadbeef | 8221587 | 2017-04-18 10:27:51 -0700 | [diff] [blame] | 1072 | public void getStats(RTCStatsCollectorCallback callback) { |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1073 | nativeNewGetStats(callback); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1074 | } |
| 1075 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1076 | /** |
| 1077 | * Limits the bandwidth allocated for all RTP streams sent by this |
| 1078 | * PeerConnection. Pass null to leave a value unchanged. |
| 1079 | */ |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1080 | public boolean setBitrate(Integer min, Integer current, Integer max) { |
| 1081 | return nativeSetBitrate(min, current, max); |
| 1082 | } |
zstein | d89b0bc | 2017-08-03 11:11:40 -0700 | [diff] [blame] | 1083 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1084 | /** |
| 1085 | * Starts recording an RTC event log. |
| 1086 | * |
| 1087 | * Ownership of the file is transfered to the native code. If an RTC event |
| 1088 | * log is already being recorded, it will be stopped and a new one will start |
| 1089 | * using the provided file. Logging will continue until the stopRtcEventLog |
| 1090 | * function is called. The max_size_bytes argument is ignored, it is added |
| 1091 | * for future use. |
| 1092 | */ |
ivoc | 0c6f0f6 | 2016-07-06 04:34:23 -0700 | [diff] [blame] | 1093 | public boolean startRtcEventLog(int file_descriptor, int max_size_bytes) { |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1094 | return nativeStartRtcEventLog(file_descriptor, max_size_bytes); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 1095 | } |
| 1096 | |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1097 | /** |
| 1098 | * Stops recording an RTC event log. If no RTC event log is currently being |
| 1099 | * recorded, this call will have no effect. |
| 1100 | */ |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 1101 | public void stopRtcEventLog() { |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1102 | nativeStopRtcEventLog(); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 1103 | } |
| 1104 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1105 | // TODO(fischman): add support for DTMF-related methods once that API |
| 1106 | // stabilizes. |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1107 | public SignalingState signalingState() { |
| 1108 | return nativeSignalingState(); |
| 1109 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1110 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1111 | public IceConnectionState iceConnectionState() { |
| 1112 | return nativeIceConnectionState(); |
| 1113 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1114 | |
Jonas Olsson | f01d8c8 | 2018-11-08 15:19:04 +0100 | [diff] [blame^] | 1115 | public PeerConnectionState connectionState() { |
| 1116 | return nativeConnectionState(); |
| 1117 | } |
| 1118 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1119 | public IceGatheringState iceGatheringState() { |
| 1120 | return nativeIceGatheringState(); |
| 1121 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1122 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1123 | public void close() { |
| 1124 | nativeClose(); |
| 1125 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1126 | |
deadbeef | 43697f6 | 2017-09-12 10:52:14 -0700 | [diff] [blame] | 1127 | /** |
| 1128 | * Free native resources associated with this PeerConnection instance. |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1129 | * |
deadbeef | 43697f6 | 2017-09-12 10:52:14 -0700 | [diff] [blame] | 1130 | * This method removes a reference count from the C++ PeerConnection object, |
| 1131 | * which should result in it being destroyed. It also calls equivalent |
| 1132 | * "dispose" methods on the Java objects attached to this PeerConnection |
| 1133 | * (streams, senders, receivers), such that their associated C++ objects |
| 1134 | * will also be destroyed. |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1135 | * |
| 1136 | * <p>Note that this method cannot be safely called from an observer callback |
deadbeef | 43697f6 | 2017-09-12 10:52:14 -0700 | [diff] [blame] | 1137 | * (PeerConnection.Observer, DataChannel.Observer, etc.). If you want to, for |
| 1138 | * example, destroy the PeerConnection after an "ICE failed" callback, you |
| 1139 | * must do this asynchronously (in other words, unwind the stack first). See |
| 1140 | * <a href="https://bugs.chromium.org/p/webrtc/issues/detail?id=3721">bug |
| 1141 | * 3721</a> for more details. |
| 1142 | */ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1143 | public void dispose() { |
| 1144 | close(); |
| 1145 | for (MediaStream stream : localStreams) { |
Sami Kalliomäki | ee05e90 | 2018-09-28 14:38:21 +0200 | [diff] [blame] | 1146 | nativeRemoveLocalStream(stream.getNativeMediaStream()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1147 | stream.dispose(); |
| 1148 | } |
| 1149 | localStreams.clear(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 1150 | for (RtpSender sender : senders) { |
| 1151 | sender.dispose(); |
| 1152 | } |
| 1153 | senders.clear(); |
| 1154 | for (RtpReceiver receiver : receivers) { |
| 1155 | receiver.dispose(); |
| 1156 | } |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1157 | for (RtpTransceiver transceiver : transceivers) { |
| 1158 | transceiver.dispose(); |
| 1159 | } |
| 1160 | transceivers.clear(); |
deadbeef | 4139c0f | 2015-10-06 12:29:25 -0700 | [diff] [blame] | 1161 | receivers.clear(); |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 1162 | nativeFreeOwnedPeerConnection(nativePeerConnection); |
| 1163 | } |
| 1164 | |
| 1165 | /** Returns a pointer to the native webrtc::PeerConnectionInterface. */ |
| 1166 | public long getNativePeerConnection() { |
| 1167 | return nativeGetNativePeerConnection(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1168 | } |
| 1169 | |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 1170 | @CalledByNative |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 1171 | long getNativeOwnedPeerConnection() { |
Magnus Jedvert | 9060eb1 | 2017-12-12 12:52:54 +0100 | [diff] [blame] | 1172 | return nativePeerConnection; |
| 1173 | } |
| 1174 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1175 | public static long createNativePeerConnectionObserver(Observer observer) { |
| 1176 | return nativeCreatePeerConnectionObserver(observer); |
| 1177 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1178 | |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 1179 | private native long nativeGetNativePeerConnection(); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1180 | private native SessionDescription nativeGetLocalDescription(); |
| 1181 | private native SessionDescription nativeGetRemoteDescription(); |
Michael Iedema | 0213786 | 2018-10-09 15:30:01 +0200 | [diff] [blame] | 1182 | private native RtcCertificatePem nativeGetCertificate(); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1183 | private native DataChannel nativeCreateDataChannel(String label, DataChannel.Init init); |
| 1184 | private native void nativeCreateOffer(SdpObserver observer, MediaConstraints constraints); |
| 1185 | private native void nativeCreateAnswer(SdpObserver observer, MediaConstraints constraints); |
| 1186 | private native void nativeSetLocalDescription(SdpObserver observer, SessionDescription sdp); |
| 1187 | private native void nativeSetRemoteDescription(SdpObserver observer, SessionDescription sdp); |
| 1188 | private native void nativeSetAudioPlayout(boolean playout); |
| 1189 | private native void nativeSetAudioRecording(boolean recording); |
| 1190 | private native boolean nativeSetBitrate(Integer min, Integer current, Integer max); |
| 1191 | private native SignalingState nativeSignalingState(); |
| 1192 | private native IceConnectionState nativeIceConnectionState(); |
Jonas Olsson | f01d8c8 | 2018-11-08 15:19:04 +0100 | [diff] [blame^] | 1193 | private native PeerConnectionState nativeConnectionState(); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1194 | private native IceGatheringState nativeIceGatheringState(); |
| 1195 | private native void nativeClose(); |
| 1196 | private static native long nativeCreatePeerConnectionObserver(Observer observer); |
Sami Kalliomäki | ce5c19a | 2018-01-15 09:28:34 +0100 | [diff] [blame] | 1197 | private static native void nativeFreeOwnedPeerConnection(long ownedPeerConnection); |
| 1198 | private native boolean nativeSetConfiguration(RTCConfiguration config); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1199 | private native boolean nativeAddIceCandidate( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1200 | String sdpMid, int sdpMLineIndex, String iceCandidateSdp); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1201 | private native boolean nativeRemoveIceCandidates(final IceCandidate[] candidates); |
| 1202 | private native boolean nativeAddLocalStream(long stream); |
| 1203 | private native void nativeRemoveLocalStream(long stream); |
| 1204 | private native boolean nativeOldGetStats(StatsObserver observer, long nativeTrack); |
| 1205 | private native void nativeNewGetStats(RTCStatsCollectorCallback callback); |
| 1206 | private native RtpSender nativeCreateSender(String kind, String stream_id); |
| 1207 | private native List<RtpSender> nativeGetSenders(); |
| 1208 | private native List<RtpReceiver> nativeGetReceivers(); |
Seth Hampson | c384e14 | 2018-03-06 15:47:10 -0800 | [diff] [blame] | 1209 | private native List<RtpTransceiver> nativeGetTransceivers(); |
| 1210 | private native RtpSender nativeAddTrack(long track, List<String> streamIds); |
| 1211 | private native boolean nativeRemoveTrack(long sender); |
| 1212 | private native RtpTransceiver nativeAddTransceiverWithTrack( |
| 1213 | long track, RtpTransceiver.RtpTransceiverInit init); |
| 1214 | private native RtpTransceiver nativeAddTransceiverOfType( |
| 1215 | MediaStreamTrack.MediaType mediaType, RtpTransceiver.RtpTransceiverInit init); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 1216 | private native boolean nativeStartRtcEventLog(int file_descriptor, int max_size_bytes); |
| 1217 | private native void nativeStopRtcEventLog(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1218 | } |