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