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 2012 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 | |
| 11 | // This file contains the PeerConnection interface as defined in |
| 12 | // http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-connections. |
| 13 | // Applications must use this interface to implement peerconnection. |
| 14 | // PeerConnectionFactory class provides factory methods to create |
| 15 | // peerconnection, mediastream and media tracks objects. |
| 16 | // |
| 17 | // The Following steps are needed to setup a typical call using Jsep. |
| 18 | // 1. Create a PeerConnectionFactoryInterface. Check constructors for more |
| 19 | // information about input parameters. |
| 20 | // 2. Create a PeerConnection object. Provide a configuration string which |
| 21 | // points either to stun or turn server to generate ICE candidates and provide |
| 22 | // an object that implements the PeerConnectionObserver interface. |
| 23 | // 3. Create local MediaStream and MediaTracks using the PeerConnectionFactory |
| 24 | // and add it to PeerConnection by calling AddStream. |
| 25 | // 4. Create an offer and serialize it and send it to the remote peer. |
| 26 | // 5. Once an ice candidate have been found PeerConnection will call the |
| 27 | // observer function OnIceCandidate. The candidates must also be serialized and |
| 28 | // sent to the remote peer. |
| 29 | // 6. Once an answer is received from the remote peer, call |
| 30 | // SetLocalSessionDescription with the offer and SetRemoteSessionDescription |
| 31 | // with the remote answer. |
| 32 | // 7. Once a remote candidate is received from the remote peer, provide it to |
| 33 | // the peerconnection by calling AddIceCandidate. |
| 34 | |
| 35 | |
| 36 | // The Receiver of a call can decide to accept or reject the call. |
| 37 | // This decision will be taken by the application not peerconnection. |
| 38 | // If application decides to accept the call |
| 39 | // 1. Create PeerConnectionFactoryInterface if it doesn't exist. |
| 40 | // 2. Create a new PeerConnection. |
| 41 | // 3. Provide the remote offer to the new PeerConnection object by calling |
| 42 | // SetRemoteSessionDescription. |
| 43 | // 4. Generate an answer to the remote offer by calling CreateAnswer and send it |
| 44 | // back to the remote peer. |
| 45 | // 5. Provide the local answer to the new PeerConnection by calling |
| 46 | // SetLocalSessionDescription with the answer. |
| 47 | // 6. Provide the remote ice candidates by calling AddIceCandidate. |
| 48 | // 7. Once a candidate have been found PeerConnection will call the observer |
| 49 | // function OnIceCandidate. Send these candidates to the remote peer. |
| 50 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 51 | #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
| 52 | #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 53 | |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 54 | #include <memory> |
deadbeef | 3edec7c | 2016-12-10 11:44:26 -0800 | [diff] [blame] | 55 | #include <ostream> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 56 | #include <string> |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 57 | #include <utility> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 58 | #include <vector> |
| 59 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 60 | #include "webrtc/api/datachannelinterface.h" |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 61 | #include "webrtc/api/dtmfsenderinterface.h" |
| 62 | #include "webrtc/api/jsep.h" |
| 63 | #include "webrtc/api/mediastreaminterface.h" |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 64 | #include "webrtc/api/rtcstatscollector.h" |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 65 | #include "webrtc/api/rtpreceiverinterface.h" |
| 66 | #include "webrtc/api/rtpsenderinterface.h" |
| 67 | #include "webrtc/api/statstypes.h" |
| 68 | #include "webrtc/api/umametrics.h" |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 69 | #include "webrtc/base/fileutils.h" |
phoglund@webrtc.org | 006521d | 2015-02-12 09:23:59 +0000 | [diff] [blame] | 70 | #include "webrtc/base/network.h" |
Henrik Boström | 87713d0 | 2015-08-25 09:53:21 +0200 | [diff] [blame] | 71 | #include "webrtc/base/rtccertificate.h" |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 72 | #include "webrtc/base/rtccertificategenerator.h" |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 73 | #include "webrtc/base/socketaddress.h" |
kjellander | a96e2d7 | 2016-02-04 23:52:28 -0800 | [diff] [blame] | 74 | #include "webrtc/base/sslstreamadapter.h" |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 75 | #include "webrtc/media/base/mediachannel.h" |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 76 | #include "webrtc/p2p/base/portallocator.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 77 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 78 | namespace rtc { |
jiayl@webrtc.org | 61e00b0 | 2015-03-04 22:17:38 +0000 | [diff] [blame] | 79 | class SSLIdentity; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 80 | class Thread; |
| 81 | } |
| 82 | |
| 83 | namespace cricket { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 84 | class WebRtcVideoDecoderFactory; |
| 85 | class WebRtcVideoEncoderFactory; |
| 86 | } |
| 87 | |
| 88 | namespace webrtc { |
| 89 | class AudioDeviceModule; |
gyzhou | 95aa964 | 2016-12-13 14:06:26 -0800 | [diff] [blame] | 90 | class AudioMixer; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 91 | class MediaConstraintsInterface; |
| 92 | |
| 93 | // MediaStream container interface. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 94 | class StreamCollectionInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 95 | public: |
| 96 | // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. |
| 97 | virtual size_t count() = 0; |
| 98 | virtual MediaStreamInterface* at(size_t index) = 0; |
| 99 | virtual MediaStreamInterface* find(const std::string& label) = 0; |
| 100 | virtual MediaStreamTrackInterface* FindAudioTrack( |
| 101 | const std::string& id) = 0; |
| 102 | virtual MediaStreamTrackInterface* FindVideoTrack( |
| 103 | const std::string& id) = 0; |
| 104 | |
| 105 | protected: |
| 106 | // Dtor protected as objects shouldn't be deleted via this interface. |
| 107 | ~StreamCollectionInterface() {} |
| 108 | }; |
| 109 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 110 | class StatsObserver : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 111 | public: |
nisse | b36ee8d | 2016-12-20 03:30:00 -0800 | [diff] [blame] | 112 | // TODO(nisse, hbos): Old version, not passing ownership. Should |
| 113 | // perhaps be deprecated, but since all of this is a legacy |
| 114 | // interface anyway, probably best to leave as is until this class |
| 115 | // can be deleted. |
| 116 | virtual void OnComplete(const StatsReports& reports) {} |
| 117 | virtual void OnCompleteReports(std::unique_ptr<StatsReports> reports) { |
| 118 | OnComplete(*reports); |
| 119 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 120 | |
| 121 | protected: |
| 122 | virtual ~StatsObserver() {} |
| 123 | }; |
| 124 | |
deadbeef | 3edec7c | 2016-12-10 11:44:26 -0800 | [diff] [blame] | 125 | // Enumeration to represent distinct classes of errors that an application |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 126 | // may wish to act upon differently. These roughly map to DOMExceptions or |
| 127 | // RTCError "errorDetailEnum" values in the web API, as described in the |
| 128 | // comments below. |
| 129 | enum class RTCErrorType { |
deadbeef | 3edec7c | 2016-12-10 11:44:26 -0800 | [diff] [blame] | 130 | // No error. |
| 131 | NONE, |
| 132 | // A supplied parameter is valid, but currently unsupported. |
| 133 | // Maps to InvalidAccessError DOMException. |
| 134 | UNSUPPORTED_PARAMETER, |
| 135 | // General error indicating that a supplied parameter is invalid. |
| 136 | // Maps to InvalidAccessError or TypeError DOMException depending on context. |
| 137 | INVALID_PARAMETER, |
| 138 | // Slightly more specific than INVALID_PARAMETER; a parameter's value was |
| 139 | // outside the allowed range. |
| 140 | // Maps to RangeError DOMException. |
| 141 | INVALID_RANGE, |
| 142 | // Slightly more specific than INVALID_PARAMETER; an error occurred while |
| 143 | // parsing string input. |
| 144 | // Maps to SyntaxError DOMException. |
| 145 | SYNTAX_ERROR, |
| 146 | // The object does not support this operation in its current state. |
| 147 | // Maps to InvalidStateError DOMException. |
| 148 | INVALID_STATE, |
| 149 | // An attempt was made to modify the object in an invalid way. |
| 150 | // Maps to InvalidModificationError DOMException. |
| 151 | INVALID_MODIFICATION, |
| 152 | // An error occurred within an underlying network protocol. |
| 153 | // Maps to NetworkError DOMException. |
| 154 | NETWORK_ERROR, |
| 155 | // The operation failed due to an internal error. |
| 156 | // Maps to OperationError DOMException. |
| 157 | INTERNAL_ERROR, |
| 158 | }; |
| 159 | |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 160 | // Roughly corresponds to RTCError in the web api. Holds an error type and |
| 161 | // possibly additional information specific to that error. |
| 162 | // |
| 163 | // Doesn't contain anything beyond a type now, but will in the future as more |
| 164 | // errors are implemented. |
| 165 | class RTCError { |
| 166 | public: |
| 167 | RTCError() : type_(RTCErrorType::NONE) {} |
| 168 | explicit RTCError(RTCErrorType type) : type_(type) {} |
| 169 | |
| 170 | RTCErrorType type() const { return type_; } |
| 171 | void set_type(RTCErrorType type) { type_ = type; } |
| 172 | |
| 173 | private: |
| 174 | RTCErrorType type_; |
| 175 | }; |
| 176 | |
deadbeef | 3edec7c | 2016-12-10 11:44:26 -0800 | [diff] [blame] | 177 | // Outputs the error as a friendly string. |
| 178 | // Update this method when adding a new error type. |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 179 | std::ostream& operator<<(std::ostream& stream, RTCErrorType error); |
deadbeef | 3edec7c | 2016-12-10 11:44:26 -0800 | [diff] [blame] | 180 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 181 | class PeerConnectionInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 182 | public: |
| 183 | // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . |
| 184 | enum SignalingState { |
| 185 | kStable, |
| 186 | kHaveLocalOffer, |
| 187 | kHaveLocalPrAnswer, |
| 188 | kHaveRemoteOffer, |
| 189 | kHaveRemotePrAnswer, |
| 190 | kClosed, |
| 191 | }; |
| 192 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 193 | enum IceGatheringState { |
| 194 | kIceGatheringNew, |
| 195 | kIceGatheringGathering, |
| 196 | kIceGatheringComplete |
| 197 | }; |
| 198 | |
| 199 | enum IceConnectionState { |
| 200 | kIceConnectionNew, |
| 201 | kIceConnectionChecking, |
| 202 | kIceConnectionConnected, |
| 203 | kIceConnectionCompleted, |
| 204 | kIceConnectionFailed, |
| 205 | kIceConnectionDisconnected, |
| 206 | kIceConnectionClosed, |
Guo-wei Shieh | 3d564c1 | 2015-08-19 16:51:15 -0700 | [diff] [blame] | 207 | kIceConnectionMax, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 208 | }; |
| 209 | |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 210 | // TLS certificate policy. |
| 211 | enum TlsCertPolicy { |
| 212 | // For TLS based protocols, ensure the connection is secure by not |
| 213 | // circumventing certificate validation. |
| 214 | kTlsCertPolicySecure, |
| 215 | // For TLS based protocols, disregard security completely by skipping |
| 216 | // certificate validation. This is insecure and should never be used unless |
| 217 | // security is irrelevant in that particular context. |
| 218 | kTlsCertPolicyInsecureNoCheck, |
| 219 | }; |
| 220 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 221 | struct IceServer { |
Joachim Bauch | 7c4e745 | 2015-05-28 23:06:30 +0200 | [diff] [blame] | 222 | // TODO(jbauch): Remove uri when all code using it has switched to urls. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 223 | std::string uri; |
Joachim Bauch | 7c4e745 | 2015-05-28 23:06:30 +0200 | [diff] [blame] | 224 | std::vector<std::string> urls; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 225 | std::string username; |
| 226 | std::string password; |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 227 | TlsCertPolicy tls_cert_policy = kTlsCertPolicySecure; |
| 228 | |
deadbeef | d1a38b5 | 2016-12-10 13:15:33 -0800 | [diff] [blame] | 229 | bool operator==(const IceServer& o) const { |
| 230 | return uri == o.uri && urls == o.urls && username == o.username && |
hnsl | 0483362 | 2017-01-09 08:35:45 -0800 | [diff] [blame] | 231 | password == o.password && tls_cert_policy == o.tls_cert_policy; |
deadbeef | d1a38b5 | 2016-12-10 13:15:33 -0800 | [diff] [blame] | 232 | } |
| 233 | bool operator!=(const IceServer& o) const { return !(*this == o); } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 234 | }; |
| 235 | typedef std::vector<IceServer> IceServers; |
| 236 | |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 237 | enum IceTransportsType { |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 238 | // TODO(pthatcher): Rename these kTransporTypeXXX, but update |
| 239 | // Chromium at the same time. |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 240 | kNone, |
| 241 | kRelay, |
| 242 | kNoHost, |
| 243 | kAll |
| 244 | }; |
| 245 | |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 246 | // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1 |
| 247 | enum BundlePolicy { |
| 248 | kBundlePolicyBalanced, |
| 249 | kBundlePolicyMaxBundle, |
| 250 | kBundlePolicyMaxCompat |
| 251 | }; |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 252 | |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 253 | // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1 |
| 254 | enum RtcpMuxPolicy { |
| 255 | kRtcpMuxPolicyNegotiate, |
| 256 | kRtcpMuxPolicyRequire, |
| 257 | }; |
| 258 | |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 259 | enum TcpCandidatePolicy { |
| 260 | kTcpCandidatePolicyEnabled, |
| 261 | kTcpCandidatePolicyDisabled |
| 262 | }; |
| 263 | |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 264 | enum CandidateNetworkPolicy { |
| 265 | kCandidateNetworkPolicyAll, |
| 266 | kCandidateNetworkPolicyLowCost |
| 267 | }; |
| 268 | |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 269 | enum ContinualGatheringPolicy { |
| 270 | GATHER_ONCE, |
| 271 | GATHER_CONTINUALLY |
| 272 | }; |
| 273 | |
Honghai Zhang | f7ddc06 | 2016-09-01 15:34:01 -0700 | [diff] [blame] | 274 | enum class RTCConfigurationType { |
| 275 | // A configuration that is safer to use, despite not having the best |
| 276 | // performance. Currently this is the default configuration. |
| 277 | kSafe, |
| 278 | // An aggressive configuration that has better performance, although it |
| 279 | // may be riskier and may need extra support in the application. |
| 280 | kAggressive |
| 281 | }; |
| 282 | |
Henrik Boström | 87713d0 | 2015-08-25 09:53:21 +0200 | [diff] [blame] | 283 | // TODO(hbos): Change into class with private data and public getters. |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 284 | // TODO(nisse): In particular, accessing fields directly from an |
| 285 | // application is brittle, since the organization mirrors the |
| 286 | // organization of the implementation, which isn't stable. So we |
| 287 | // need getters and setters at least for fields which applications |
| 288 | // are interested in. |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 289 | struct RTCConfiguration { |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 290 | // This struct is subject to reorganization, both for naming |
| 291 | // consistency, and to group settings to match where they are used |
| 292 | // in the implementation. To do that, we need getter and setter |
| 293 | // methods for all settings which are of interest to applications, |
| 294 | // Chrome in particular. |
| 295 | |
Honghai Zhang | f7ddc06 | 2016-09-01 15:34:01 -0700 | [diff] [blame] | 296 | RTCConfiguration() = default; |
| 297 | RTCConfiguration(RTCConfigurationType type) { |
| 298 | if (type == RTCConfigurationType::kAggressive) { |
Honghai Zhang | aecd982 | 2016-09-02 16:58:17 -0700 | [diff] [blame] | 299 | // These parameters are also defined in Java and IOS configurations, |
| 300 | // so their values may be overwritten by the Java or IOS configuration. |
| 301 | bundle_policy = kBundlePolicyMaxBundle; |
| 302 | rtcp_mux_policy = kRtcpMuxPolicyRequire; |
| 303 | ice_connection_receiving_timeout = |
| 304 | kAggressiveIceConnectionReceivingTimeout; |
| 305 | |
| 306 | // These parameters are not defined in Java or IOS configuration, |
| 307 | // so their values will not be overwritten. |
| 308 | enable_ice_renomination = true; |
Honghai Zhang | f7ddc06 | 2016-09-01 15:34:01 -0700 | [diff] [blame] | 309 | redetermine_role_on_ice_restart = false; |
| 310 | } |
Honghai Zhang | bfd398c | 2016-08-30 22:07:42 -0700 | [diff] [blame] | 311 | } |
| 312 | |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 313 | bool operator==(const RTCConfiguration& o) const; |
| 314 | bool operator!=(const RTCConfiguration& o) const; |
| 315 | |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 316 | bool dscp() { return media_config.enable_dscp; } |
| 317 | void set_dscp(bool enable) { media_config.enable_dscp = enable; } |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 318 | |
| 319 | // TODO(nisse): The corresponding flag in MediaConfig and |
| 320 | // elsewhere should be renamed enable_cpu_adaptation. |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 321 | bool cpu_adaptation() { |
| 322 | return media_config.video.enable_cpu_overuse_detection; |
| 323 | } |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 324 | void set_cpu_adaptation(bool enable) { |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 325 | media_config.video.enable_cpu_overuse_detection = enable; |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 326 | } |
| 327 | |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 328 | bool suspend_below_min_bitrate() { |
| 329 | return media_config.video.suspend_below_min_bitrate; |
| 330 | } |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 331 | void set_suspend_below_min_bitrate(bool enable) { |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 332 | media_config.video.suspend_below_min_bitrate = enable; |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | // TODO(nisse): The negation in the corresponding MediaConfig |
| 336 | // attribute is inconsistent, and it should be renamed at some |
| 337 | // point. |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 338 | bool prerenderer_smoothing() { |
| 339 | return !media_config.video.disable_prerenderer_smoothing; |
| 340 | } |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 341 | void set_prerenderer_smoothing(bool enable) { |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 342 | media_config.video.disable_prerenderer_smoothing = !enable; |
Niels Möller | 71bdda0 | 2016-03-31 12:59:59 +0200 | [diff] [blame] | 343 | } |
| 344 | |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 345 | static const int kUndefined = -1; |
| 346 | // Default maximum number of packets in the audio jitter buffer. |
| 347 | static const int kAudioJitterBufferMaxPackets = 50; |
Honghai Zhang | aecd982 | 2016-09-02 16:58:17 -0700 | [diff] [blame] | 348 | // ICE connection receiving timeout for aggressive configuration. |
| 349 | static const int kAggressiveIceConnectionReceivingTimeout = 1000; |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 350 | // TODO(pthatcher): Rename this ice_transport_type, but update |
| 351 | // Chromium at the same time. |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 352 | IceTransportsType type = kAll; |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 353 | // TODO(pthatcher): Rename this ice_servers, but update Chromium |
| 354 | // at the same time. |
| 355 | IceServers servers; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 356 | BundlePolicy bundle_policy = kBundlePolicyBalanced; |
zhihuang | 4dfb8ce | 2016-11-23 10:30:12 -0800 | [diff] [blame] | 357 | RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 358 | TcpCandidatePolicy tcp_candidate_policy = kTcpCandidatePolicyEnabled; |
honghaiz | 6034705 | 2016-05-31 18:29:12 -0700 | [diff] [blame] | 359 | CandidateNetworkPolicy candidate_network_policy = |
| 360 | kCandidateNetworkPolicyAll; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 361 | int audio_jitter_buffer_max_packets = kAudioJitterBufferMaxPackets; |
| 362 | bool audio_jitter_buffer_fast_accelerate = false; |
| 363 | int ice_connection_receiving_timeout = kUndefined; // ms |
| 364 | int ice_backup_candidate_pair_ping_interval = kUndefined; // ms |
| 365 | ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE; |
Henrik Boström | 87713d0 | 2015-08-25 09:53:21 +0200 | [diff] [blame] | 366 | std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 367 | bool prioritize_most_likely_ice_candidate_pairs = false; |
nisse | c36b31b | 2016-04-11 23:25:29 -0700 | [diff] [blame] | 368 | struct cricket::MediaConfig media_config; |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 369 | // Flags corresponding to values set by constraint flags. |
| 370 | // rtc::Optional flags can be "missing", in which case the webrtc |
| 371 | // default applies. |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 372 | bool disable_ipv6 = false; |
| 373 | bool enable_rtp_data_channel = false; |
zhihuang | 9763d56 | 2016-08-05 11:14:50 -0700 | [diff] [blame] | 374 | bool enable_quic = false; |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 375 | rtc::Optional<int> screencast_min_bitrate; |
| 376 | rtc::Optional<bool> combined_audio_video_bwe; |
| 377 | rtc::Optional<bool> enable_dtls_srtp; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 378 | int ice_candidate_pool_size = 0; |
Honghai Zhang | b9e7b4a | 2016-06-30 20:52:02 -0700 | [diff] [blame] | 379 | bool prune_turn_ports = false; |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 380 | // If set to true, this means the ICE transport should presume TURN-to-TURN |
| 381 | // candidate pairs will succeed, even before a binding response is received. |
| 382 | bool presume_writable_when_fully_relayed = false; |
Honghai Zhang | 4cedf2b | 2016-08-31 08:18:11 -0700 | [diff] [blame] | 383 | // If true, "renomination" will be added to the ice options in the transport |
| 384 | // description. |
| 385 | bool enable_ice_renomination = false; |
Honghai Zhang | bfd398c | 2016-08-30 22:07:42 -0700 | [diff] [blame] | 386 | // If true, ICE role is redetermined when peerconnection sets a local |
| 387 | // transport description that indicates an ICE restart. |
| 388 | bool redetermine_role_on_ice_restart = true; |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 389 | // |
| 390 | // Don't forget to update operator== if adding something. |
| 391 | // |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 392 | }; |
| 393 | |
jiayl@webrtc.org | b18bf5e | 2014-08-04 18:34:16 +0000 | [diff] [blame] | 394 | struct RTCOfferAnswerOptions { |
| 395 | static const int kUndefined = -1; |
| 396 | static const int kMaxOfferToReceiveMedia = 1; |
| 397 | |
| 398 | // The default value for constraint offerToReceiveX:true. |
| 399 | static const int kOfferToReceiveMediaTrue = 1; |
| 400 | |
Honghai Zhang | 4cedf2b | 2016-08-31 08:18:11 -0700 | [diff] [blame] | 401 | int offer_to_receive_video = kUndefined; |
| 402 | int offer_to_receive_audio = kUndefined; |
| 403 | bool voice_activity_detection = true; |
| 404 | bool ice_restart = false; |
| 405 | bool use_rtp_mux = true; |
jiayl@webrtc.org | b18bf5e | 2014-08-04 18:34:16 +0000 | [diff] [blame] | 406 | |
Honghai Zhang | 4cedf2b | 2016-08-31 08:18:11 -0700 | [diff] [blame] | 407 | RTCOfferAnswerOptions() = default; |
jiayl@webrtc.org | b18bf5e | 2014-08-04 18:34:16 +0000 | [diff] [blame] | 408 | |
| 409 | RTCOfferAnswerOptions(int offer_to_receive_video, |
| 410 | int offer_to_receive_audio, |
| 411 | bool voice_activity_detection, |
| 412 | bool ice_restart, |
| 413 | bool use_rtp_mux) |
| 414 | : offer_to_receive_video(offer_to_receive_video), |
| 415 | offer_to_receive_audio(offer_to_receive_audio), |
| 416 | voice_activity_detection(voice_activity_detection), |
| 417 | ice_restart(ice_restart), |
| 418 | use_rtp_mux(use_rtp_mux) {} |
| 419 | }; |
| 420 | |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 421 | // Used by GetStats to decide which stats to include in the stats reports. |
| 422 | // |kStatsOutputLevelStandard| includes the standard stats for Javascript API; |
| 423 | // |kStatsOutputLevelDebug| includes both the standard stats and additional |
| 424 | // stats for debugging purposes. |
| 425 | enum StatsOutputLevel { |
| 426 | kStatsOutputLevelStandard, |
| 427 | kStatsOutputLevelDebug, |
| 428 | }; |
| 429 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 430 | // Accessor methods to active local streams. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 431 | virtual rtc::scoped_refptr<StreamCollectionInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 432 | local_streams() = 0; |
| 433 | |
| 434 | // Accessor methods to remote streams. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 435 | virtual rtc::scoped_refptr<StreamCollectionInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 436 | remote_streams() = 0; |
| 437 | |
| 438 | // Add a new MediaStream to be sent on this PeerConnection. |
| 439 | // Note that a SessionDescription negotiation is needed before the |
| 440 | // remote peer can receive the stream. |
perkj@webrtc.org | fd0efb6 | 2014-11-06 12:16:36 +0000 | [diff] [blame] | 441 | virtual bool AddStream(MediaStreamInterface* stream) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 442 | |
| 443 | // Remove a MediaStream from this PeerConnection. |
| 444 | // Note that a SessionDescription negotiation is need before the |
| 445 | // remote peer is notified. |
| 446 | virtual void RemoveStream(MediaStreamInterface* stream) = 0; |
| 447 | |
deadbeef | e1f9d83 | 2016-01-14 15:35:42 -0800 | [diff] [blame] | 448 | // TODO(deadbeef): Make the following two methods pure virtual once |
| 449 | // implemented by all subclasses of PeerConnectionInterface. |
| 450 | // Add a new MediaStreamTrack to be sent on this PeerConnection. |
| 451 | // |streams| indicates which stream labels the track should be associated |
| 452 | // with. |
| 453 | virtual rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
| 454 | MediaStreamTrackInterface* track, |
| 455 | std::vector<MediaStreamInterface*> streams) { |
| 456 | return nullptr; |
| 457 | } |
| 458 | |
| 459 | // Remove an RtpSender from this PeerConnection. |
| 460 | // Returns true on success. |
| 461 | virtual bool RemoveTrack(RtpSenderInterface* sender) { |
| 462 | return false; |
| 463 | } |
| 464 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 465 | // Returns pointer to the created DtmfSender on success. |
| 466 | // Otherwise returns NULL. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 467 | virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 468 | AudioTrackInterface* track) = 0; |
| 469 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 470 | // TODO(deadbeef): Make these pure virtual once all subclasses implement them. |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 471 | // |kind| must be "audio" or "video". |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 472 | // |stream_id| is used to populate the msid attribute; if empty, one will |
| 473 | // be generated automatically. |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 474 | virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender( |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 475 | const std::string& kind, |
| 476 | const std::string& stream_id) { |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 477 | return rtc::scoped_refptr<RtpSenderInterface>(); |
| 478 | } |
| 479 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 480 | virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders() |
| 481 | const { |
| 482 | return std::vector<rtc::scoped_refptr<RtpSenderInterface>>(); |
| 483 | } |
| 484 | |
| 485 | virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers() |
| 486 | const { |
| 487 | return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>(); |
| 488 | } |
| 489 | |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 490 | virtual bool GetStats(StatsObserver* observer, |
| 491 | MediaStreamTrackInterface* track, |
| 492 | StatsOutputLevel level) = 0; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 493 | // Gets stats using the new stats collection API, see webrtc/api/stats/. These |
| 494 | // will replace old stats collection API when the new API has matured enough. |
hbos | e381015 | 2016-12-13 02:35:19 -0800 | [diff] [blame] | 495 | // TODO(hbos): Default implementation that does nothing only exists as to not |
| 496 | // break third party projects. As soon as they have been updated this should |
| 497 | // be changed to "= 0;". |
| 498 | virtual void GetStats(RTCStatsCollectorCallback* callback) {} |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 499 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 500 | virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 501 | const std::string& label, |
| 502 | const DataChannelInit* config) = 0; |
| 503 | |
| 504 | virtual const SessionDescriptionInterface* local_description() const = 0; |
| 505 | virtual const SessionDescriptionInterface* remote_description() const = 0; |
deadbeef | fe4a8a4 | 2016-12-20 17:56:17 -0800 | [diff] [blame] | 506 | // A "current" description the one currently negotiated from a complete |
| 507 | // offer/answer exchange. |
| 508 | virtual const SessionDescriptionInterface* current_local_description() const { |
| 509 | return nullptr; |
| 510 | } |
| 511 | virtual const SessionDescriptionInterface* current_remote_description() |
| 512 | const { |
| 513 | return nullptr; |
| 514 | } |
| 515 | // A "pending" description is one that's part of an incomplete offer/answer |
| 516 | // exchange (thus, either an offer or a pranswer). Once the offer/answer |
| 517 | // exchange is finished, the "pending" description will become "current". |
| 518 | virtual const SessionDescriptionInterface* pending_local_description() const { |
| 519 | return nullptr; |
| 520 | } |
| 521 | virtual const SessionDescriptionInterface* pending_remote_description() |
| 522 | const { |
| 523 | return nullptr; |
| 524 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 525 | |
| 526 | // Create a new offer. |
| 527 | // The CreateSessionDescriptionObserver callback will be called when done. |
| 528 | virtual void CreateOffer(CreateSessionDescriptionObserver* observer, |
jiayl@webrtc.org | b18bf5e | 2014-08-04 18:34:16 +0000 | [diff] [blame] | 529 | const MediaConstraintsInterface* constraints) {} |
| 530 | |
| 531 | // TODO(jiayl): remove the default impl and the old interface when chromium |
| 532 | // code is updated. |
| 533 | virtual void CreateOffer(CreateSessionDescriptionObserver* observer, |
| 534 | const RTCOfferAnswerOptions& options) {} |
| 535 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 536 | // Create an answer to an offer. |
| 537 | // The CreateSessionDescriptionObserver callback will be called when done. |
| 538 | virtual void CreateAnswer(CreateSessionDescriptionObserver* observer, |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 539 | const RTCOfferAnswerOptions& options) {} |
| 540 | // Deprecated - use version above. |
| 541 | // TODO(hta): Remove and remove default implementations when all callers |
| 542 | // are updated. |
| 543 | virtual void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 544 | const MediaConstraintsInterface* constraints) {} |
| 545 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 546 | // Sets the local session description. |
| 547 | // JsepInterface takes the ownership of |desc| even if it fails. |
| 548 | // The |observer| callback will be called when done. |
| 549 | virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, |
| 550 | SessionDescriptionInterface* desc) = 0; |
| 551 | // Sets the remote session description. |
| 552 | // JsepInterface takes the ownership of |desc| even if it fails. |
| 553 | // The |observer| callback will be called when done. |
| 554 | virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
| 555 | SessionDescriptionInterface* desc) = 0; |
| 556 | // Restarts or updates the ICE Agent process of gathering local candidates |
| 557 | // and pinging remote candidates. |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 558 | // TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 559 | virtual bool UpdateIce(const IceServers& configuration, |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 560 | const MediaConstraintsInterface* constraints) { |
| 561 | return false; |
| 562 | } |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 563 | virtual bool UpdateIce(const IceServers& configuration) { return false; } |
deadbeef | 46c7389 | 2016-11-16 19:42:04 -0800 | [diff] [blame] | 564 | // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of |
| 565 | // PeerConnectionInterface implement it. |
| 566 | virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() { |
| 567 | return PeerConnectionInterface::RTCConfiguration(); |
| 568 | } |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 569 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 570 | // Sets the PeerConnection's global configuration to |config|. |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 571 | // |
| 572 | // The members of |config| that may be changed are |type|, |servers|, |
| 573 | // |ice_candidate_pool_size| and |prune_turn_ports| (though the candidate |
| 574 | // pool size can't be changed after the first call to SetLocalDescription). |
| 575 | // Note that this means the BUNDLE and RTCP-multiplexing policies cannot be |
| 576 | // changed with this method. |
| 577 | // |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 578 | // Any changes to STUN/TURN servers or ICE candidate policy will affect the |
| 579 | // next gathering phase, and cause the next call to createOffer to generate |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 580 | // new ICE credentials, as described in JSEP. This also occurs when |
| 581 | // |prune_turn_ports| changes, for the same reasoning. |
| 582 | // |
| 583 | // If an error occurs, returns false and populates |error| if non-null: |
| 584 | // - INVALID_MODIFICATION if |config| contains a modified parameter other |
| 585 | // than one of the parameters listed above. |
| 586 | // - INVALID_RANGE if |ice_candidate_pool_size| is out of range. |
| 587 | // - SYNTAX_ERROR if parsing an ICE server URL failed. |
| 588 | // - INVALID_PARAMETER if a TURN server is missing |username| or |password|. |
| 589 | // - INTERNAL_ERROR if an unexpected error occurred. |
| 590 | // |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 591 | // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of |
| 592 | // PeerConnectionInterface implement it. |
| 593 | virtual bool SetConfiguration( |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 594 | const PeerConnectionInterface::RTCConfiguration& config, |
| 595 | RTCError* error) { |
| 596 | return false; |
| 597 | } |
| 598 | // Version without error output param for backwards compatibility. |
| 599 | // TODO(deadbeef): Remove once chromium is updated. |
| 600 | virtual bool SetConfiguration( |
deadbeef | 1e23461 | 2016-12-24 01:43:32 -0800 | [diff] [blame] | 601 | const PeerConnectionInterface::RTCConfiguration& config) { |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 602 | return false; |
| 603 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 604 | // Provides a remote candidate to the ICE Agent. |
| 605 | // A copy of the |candidate| will be created and added to the remote |
| 606 | // description. So the caller of this method still has the ownership of the |
| 607 | // |candidate|. |
| 608 | // TODO(ronghuawu): Consider to change this so that the AddIceCandidate will |
| 609 | // take the ownership of the |candidate|. |
| 610 | virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0; |
| 611 | |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 612 | // Removes a group of remote candidates from the ICE agent. |
| 613 | virtual bool RemoveIceCandidates( |
| 614 | const std::vector<cricket::Candidate>& candidates) { |
| 615 | return false; |
| 616 | } |
| 617 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 +0000 | [diff] [blame] | 618 | virtual void RegisterUMAObserver(UMAObserver* observer) = 0; |
| 619 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 620 | // Returns the current SignalingState. |
| 621 | virtual SignalingState signaling_state() = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 622 | virtual IceConnectionState ice_connection_state() = 0; |
| 623 | virtual IceGatheringState ice_gathering_state() = 0; |
| 624 | |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 625 | // Starts RtcEventLog using existing file. Takes ownership of |file| and |
| 626 | // passes it on to Call, which will take the ownership. If the |
| 627 | // operation fails the file will be closed. The logging will stop |
| 628 | // automatically after 10 minutes have passed, or when the StopRtcEventLog |
| 629 | // function is called. |
| 630 | // TODO(ivoc): Make this pure virtual when Chrome is updated. |
| 631 | virtual bool StartRtcEventLog(rtc::PlatformFile file, |
| 632 | int64_t max_size_bytes) { |
| 633 | return false; |
| 634 | } |
| 635 | |
| 636 | // Stops logging the RtcEventLog. |
| 637 | // TODO(ivoc): Make this pure virtual when Chrome is updated. |
| 638 | virtual void StopRtcEventLog() {} |
| 639 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 640 | // Terminates all media and closes the transport. |
| 641 | virtual void Close() = 0; |
| 642 | |
| 643 | protected: |
| 644 | // Dtor protected as objects shouldn't be deleted via this interface. |
| 645 | ~PeerConnectionInterface() {} |
| 646 | }; |
| 647 | |
| 648 | // PeerConnection callback interface. Application should implement these |
| 649 | // methods. |
| 650 | class PeerConnectionObserver { |
| 651 | public: |
| 652 | enum StateType { |
| 653 | kSignalingState, |
| 654 | kIceState, |
| 655 | }; |
| 656 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 657 | // Triggered when the SignalingState changed. |
| 658 | virtual void OnSignalingChange( |
perkj | dfb769d | 2016-02-09 03:09:43 -0800 | [diff] [blame] | 659 | PeerConnectionInterface::SignalingState new_state) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 660 | |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 661 | // TODO(deadbeef): Once all subclasses override the scoped_refptr versions |
| 662 | // of the below three methods, make them pure virtual and remove the raw |
| 663 | // pointer version. |
| 664 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 665 | // Triggered when media is received on a new stream from remote peer. |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 666 | virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) {} |
| 667 | // Deprecated; please use the version that uses a scoped_refptr. |
| 668 | virtual void OnAddStream(MediaStreamInterface* stream) {} |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 669 | |
| 670 | // Triggered when a remote peer close a stream. |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 671 | virtual void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) { |
| 672 | } |
| 673 | // Deprecated; please use the version that uses a scoped_refptr. |
| 674 | virtual void OnRemoveStream(MediaStreamInterface* stream) {} |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 675 | |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 676 | // Triggered when a remote peer opens a data channel. |
| 677 | virtual void OnDataChannel( |
| 678 | rtc::scoped_refptr<DataChannelInterface> data_channel){}; |
| 679 | // Deprecated; please use the version that uses a scoped_refptr. |
| 680 | virtual void OnDataChannel(DataChannelInterface* data_channel) {} |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 681 | |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 682 | // Triggered when renegotiation is needed. For example, an ICE restart |
| 683 | // has begun. |
fischman@webrtc.org | d7568a0 | 2014-01-13 22:04:12 +0000 | [diff] [blame] | 684 | virtual void OnRenegotiationNeeded() = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 685 | |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 686 | // Called any time the IceConnectionState changes. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 687 | virtual void OnIceConnectionChange( |
perkj | dfb769d | 2016-02-09 03:09:43 -0800 | [diff] [blame] | 688 | PeerConnectionInterface::IceConnectionState new_state) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 689 | |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 690 | // Called any time the IceGatheringState changes. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 691 | virtual void OnIceGatheringChange( |
perkj | dfb769d | 2016-02-09 03:09:43 -0800 | [diff] [blame] | 692 | PeerConnectionInterface::IceGatheringState new_state) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 693 | |
Taylor Brandstetter | 98cde26 | 2016-05-31 13:02:21 -0700 | [diff] [blame] | 694 | // A new ICE candidate has been gathered. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 695 | virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; |
| 696 | |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 697 | // Ice candidates have been removed. |
| 698 | // TODO(honghaiz): Make this a pure virtual method when all its subclasses |
| 699 | // implement it. |
| 700 | virtual void OnIceCandidatesRemoved( |
| 701 | const std::vector<cricket::Candidate>& candidates) {} |
| 702 | |
Peter Thatcher | 5436051 | 2015-07-08 11:08:35 -0700 | [diff] [blame] | 703 | // Called when the ICE connection receiving status changes. |
| 704 | virtual void OnIceConnectionReceivingChange(bool receiving) {} |
| 705 | |
zhihuang | 81c3a03 | 2016-11-17 12:06:24 -0800 | [diff] [blame] | 706 | // Called when a track is added to streams. |
| 707 | // TODO(zhihuang) Make this a pure virtual method when all its subclasses |
| 708 | // implement it. |
| 709 | virtual void OnAddTrack( |
| 710 | rtc::scoped_refptr<RtpReceiverInterface> receiver, |
zhihuang | c63b894 | 2016-12-02 15:41:10 -0800 | [diff] [blame] | 711 | const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {} |
zhihuang | 81c3a03 | 2016-11-17 12:06:24 -0800 | [diff] [blame] | 712 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 713 | protected: |
| 714 | // Dtor protected as objects shouldn't be deleted via this interface. |
| 715 | ~PeerConnectionObserver() {} |
| 716 | }; |
| 717 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 718 | // PeerConnectionFactoryInterface is the factory interface use for creating |
| 719 | // PeerConnection, MediaStream and media tracks. |
| 720 | // PeerConnectionFactoryInterface will create required libjingle threads, |
| 721 | // socket and network manager factory classes for networking. |
| 722 | // If an application decides to provide its own threads and network |
| 723 | // implementation of these classes it should use the alternate |
| 724 | // CreatePeerConnectionFactory method which accepts threads as input and use the |
Taylor Brandstetter | 0c7e9f5 | 2015-12-29 14:14:52 -0800 | [diff] [blame] | 725 | // CreatePeerConnection version that takes a PortAllocator as an |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 726 | // argument. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 727 | class PeerConnectionFactoryInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 728 | public: |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 729 | class Options { |
| 730 | public: |
Guo-wei Shieh | a7446d2 | 2016-01-11 15:27:03 -0800 | [diff] [blame] | 731 | Options() |
| 732 | : disable_encryption(false), |
| 733 | disable_sctp_data_channels(false), |
| 734 | disable_network_monitor(false), |
| 735 | network_ignore_mask(rtc::kDefaultNetworkIgnoreMask), |
jbauch | cb56065 | 2016-08-04 05:20:32 -0700 | [diff] [blame] | 736 | ssl_max_version(rtc::SSL_PROTOCOL_DTLS_12), |
| 737 | crypto_options(rtc::CryptoOptions::NoGcm()) {} |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 738 | bool disable_encryption; |
| 739 | bool disable_sctp_data_channels; |
honghaiz | 023f3ef | 2015-10-19 09:39:32 -0700 | [diff] [blame] | 740 | bool disable_network_monitor; |
phoglund@webrtc.org | 006521d | 2015-02-12 09:23:59 +0000 | [diff] [blame] | 741 | |
| 742 | // Sets the network types to ignore. For instance, calling this with |
| 743 | // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and |
| 744 | // loopback interfaces. |
| 745 | int network_ignore_mask; |
Joachim Bauch | 04e5b49 | 2015-05-29 09:40:39 +0200 | [diff] [blame] | 746 | |
| 747 | // Sets the maximum supported protocol version. The highest version |
| 748 | // supported by both ends will be used for the connection, i.e. if one |
| 749 | // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. |
| 750 | rtc::SSLProtocolVersion ssl_max_version; |
jbauch | cb56065 | 2016-08-04 05:20:32 -0700 | [diff] [blame] | 751 | |
| 752 | // Sets crypto related options, e.g. enabled cipher suites. |
| 753 | rtc::CryptoOptions crypto_options; |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 754 | }; |
| 755 | |
| 756 | virtual void SetOptions(const Options& options) = 0; |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 757 | |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 758 | virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 759 | const PeerConnectionInterface::RTCConfiguration& configuration, |
| 760 | const MediaConstraintsInterface* constraints, |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 761 | std::unique_ptr<cricket::PortAllocator> allocator, |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 762 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
hbos | d7973cc | 2016-05-27 06:08:53 -0700 | [diff] [blame] | 763 | PeerConnectionObserver* observer) = 0; |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 764 | |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 765 | virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 766 | const PeerConnectionInterface::RTCConfiguration& configuration, |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 767 | std::unique_ptr<cricket::PortAllocator> allocator, |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 768 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
hbos | d7973cc | 2016-05-27 06:08:53 -0700 | [diff] [blame] | 769 | PeerConnectionObserver* observer) = 0; |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 770 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 771 | virtual rtc::scoped_refptr<MediaStreamInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 772 | CreateLocalMediaStream(const std::string& label) = 0; |
| 773 | |
| 774 | // Creates a AudioSourceInterface. |
| 775 | // |constraints| decides audio processing settings but can be NULL. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 776 | virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 777 | const cricket::AudioOptions& options) = 0; |
| 778 | // Deprecated - use version above. |
deadbeef | fe0fd41 | 2017-01-13 11:47:56 -0800 | [diff] [blame] | 779 | // Can use CopyConstraintsIntoAudioOptions to bridge the gap. |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 780 | virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 781 | const MediaConstraintsInterface* constraints) = 0; |
| 782 | |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 783 | // Creates a VideoTrackSourceInterface. The new source take ownership of |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 784 | // |capturer|. |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 785 | virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 786 | cricket::VideoCapturer* capturer) = 0; |
| 787 | // A video source creator that allows selection of resolution and frame rate. |
| 788 | // |constraints| decides video resolution and frame rate but can |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 789 | // be NULL. |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 790 | // In the NULL case, use the version above. |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 791 | virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 792 | cricket::VideoCapturer* capturer, |
| 793 | const MediaConstraintsInterface* constraints) = 0; |
| 794 | |
| 795 | // Creates a new local VideoTrack. The same |source| can be used in several |
| 796 | // tracks. |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 797 | virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( |
| 798 | const std::string& label, |
| 799 | VideoTrackSourceInterface* source) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 800 | |
| 801 | // Creates an new AudioTrack. At the moment |source| can be NULL. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 802 | virtual rtc::scoped_refptr<AudioTrackInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 803 | CreateAudioTrack(const std::string& label, |
| 804 | AudioSourceInterface* source) = 0; |
| 805 | |
wu@webrtc.org | a989080 | 2013-12-13 00:21:03 +0000 | [diff] [blame] | 806 | // Starts AEC dump using existing file. Takes ownership of |file| and passes |
| 807 | // it on to VoiceEngine (via other objects) immediately, which will take |
wu@webrtc.org | a8910d2 | 2014-01-23 22:12:45 +0000 | [diff] [blame] | 808 | // the ownerhip. If the operation fails, the file will be closed. |
ivoc | d66b44d | 2016-01-15 03:06:36 -0800 | [diff] [blame] | 809 | // A maximum file size in bytes can be specified. When the file size limit is |
| 810 | // reached, logging is stopped automatically. If max_size_bytes is set to a |
| 811 | // value <= 0, no limit will be used, and logging will continue until the |
| 812 | // StopAecDump function is called. |
| 813 | virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) = 0; |
wu@webrtc.org | a989080 | 2013-12-13 00:21:03 +0000 | [diff] [blame] | 814 | |
ivoc | 797ef12 | 2015-10-22 03:25:41 -0700 | [diff] [blame] | 815 | // Stops logging the AEC dump. |
| 816 | virtual void StopAecDump() = 0; |
| 817 | |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 818 | // This function is deprecated and will be removed when Chrome is updated to |
| 819 | // use the equivalent function on PeerConnectionInterface. |
| 820 | // TODO(ivoc) Remove after Chrome is updated. |
ivoc | c1513ee | 2016-05-13 08:30:39 -0700 | [diff] [blame] | 821 | virtual bool StartRtcEventLog(rtc::PlatformFile file, |
| 822 | int64_t max_size_bytes) = 0; |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 823 | // This function is deprecated and will be removed when Chrome is updated to |
| 824 | // use the equivalent function on PeerConnectionInterface. |
| 825 | // TODO(ivoc) Remove after Chrome is updated. |
ivoc | 112a3d8 | 2015-10-16 02:22:18 -0700 | [diff] [blame] | 826 | virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0; |
| 827 | |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 828 | // This function is deprecated and will be removed when Chrome is updated to |
| 829 | // use the equivalent function on PeerConnectionInterface. |
| 830 | // TODO(ivoc) Remove after Chrome is updated. |
ivoc | 112a3d8 | 2015-10-16 02:22:18 -0700 | [diff] [blame] | 831 | virtual void StopRtcEventLog() = 0; |
| 832 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 833 | protected: |
| 834 | // Dtor and ctor protected as objects shouldn't be created or deleted via |
| 835 | // this interface. |
| 836 | PeerConnectionFactoryInterface() {} |
| 837 | ~PeerConnectionFactoryInterface() {} // NOLINT |
| 838 | }; |
| 839 | |
| 840 | // Create a new instance of PeerConnectionFactoryInterface. |
Taylor Brandstetter | a8415fe | 2016-03-23 10:38:07 -0700 | [diff] [blame] | 841 | // |
| 842 | // This method relies on the thread it's called on as the "signaling thread" |
| 843 | // for the PeerConnectionFactory it creates. |
| 844 | // |
| 845 | // As such, if the current thread is not already running an rtc::Thread message |
| 846 | // loop, an application using this method must eventually either call |
| 847 | // rtc::Thread::Current()->Run(), or call |
| 848 | // rtc::Thread::Current()->ProcessMessages() within the application's own |
| 849 | // message loop. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 850 | rtc::scoped_refptr<PeerConnectionFactoryInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 851 | CreatePeerConnectionFactory(); |
| 852 | |
| 853 | // Create a new instance of PeerConnectionFactoryInterface. |
Taylor Brandstetter | a8415fe | 2016-03-23 10:38:07 -0700 | [diff] [blame] | 854 | // |
danilchap | e9021a3 | 2016-05-17 01:52:02 -0700 | [diff] [blame] | 855 | // |network_thread|, |worker_thread| and |signaling_thread| are |
| 856 | // the only mandatory parameters. |
Taylor Brandstetter | a8415fe | 2016-03-23 10:38:07 -0700 | [diff] [blame] | 857 | // |
| 858 | // If non-null, ownership of |default_adm|, |encoder_factory| and |
| 859 | // |decoder_factory| are transferred to the returned factory. |
danilchap | e9021a3 | 2016-05-17 01:52:02 -0700 | [diff] [blame] | 860 | rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 861 | rtc::Thread* network_thread, |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 862 | rtc::Thread* worker_thread, |
| 863 | rtc::Thread* signaling_thread, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 864 | AudioDeviceModule* default_adm, |
| 865 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 866 | cricket::WebRtcVideoDecoderFactory* decoder_factory); |
| 867 | |
gyzhou | 95aa964 | 2016-12-13 14:06:26 -0800 | [diff] [blame] | 868 | // Create a new instance of PeerConnectionFactoryInterface with external audio |
| 869 | // mixer. |
| 870 | // |
| 871 | // If |audio_mixer| is null, an internal audio mixer will be created and used. |
| 872 | rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 873 | CreatePeerConnectionFactoryWithAudioMixer( |
| 874 | rtc::Thread* network_thread, |
| 875 | rtc::Thread* worker_thread, |
| 876 | rtc::Thread* signaling_thread, |
| 877 | AudioDeviceModule* default_adm, |
| 878 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 879 | cricket::WebRtcVideoDecoderFactory* decoder_factory, |
| 880 | rtc::scoped_refptr<AudioMixer> audio_mixer); |
| 881 | |
danilchap | e9021a3 | 2016-05-17 01:52:02 -0700 | [diff] [blame] | 882 | // Create a new instance of PeerConnectionFactoryInterface. |
| 883 | // Same thread is used as worker and network thread. |
danilchap | e9021a3 | 2016-05-17 01:52:02 -0700 | [diff] [blame] | 884 | inline rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 885 | CreatePeerConnectionFactory( |
| 886 | rtc::Thread* worker_and_network_thread, |
| 887 | rtc::Thread* signaling_thread, |
| 888 | AudioDeviceModule* default_adm, |
| 889 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 890 | cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| 891 | return CreatePeerConnectionFactory( |
| 892 | worker_and_network_thread, worker_and_network_thread, signaling_thread, |
| 893 | default_adm, encoder_factory, decoder_factory); |
| 894 | } |
| 895 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 896 | } // namespace webrtc |
| 897 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 898 | #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |