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 | |
| 54 | #include <string> |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 55 | #include <utility> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 56 | #include <vector> |
| 57 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 58 | #include "webrtc/api/datachannelinterface.h" |
| 59 | #include "webrtc/api/dtlsidentitystore.h" |
| 60 | #include "webrtc/api/dtlsidentitystore.h" |
| 61 | #include "webrtc/api/dtmfsenderinterface.h" |
| 62 | #include "webrtc/api/jsep.h" |
| 63 | #include "webrtc/api/mediastreaminterface.h" |
| 64 | #include "webrtc/api/rtpreceiverinterface.h" |
| 65 | #include "webrtc/api/rtpsenderinterface.h" |
| 66 | #include "webrtc/api/statstypes.h" |
| 67 | #include "webrtc/api/umametrics.h" |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 68 | #include "webrtc/base/fileutils.h" |
phoglund@webrtc.org | 006521d | 2015-02-12 09:23:59 +0000 | [diff] [blame] | 69 | #include "webrtc/base/network.h" |
Henrik Boström | 87713d0 | 2015-08-25 09:53:21 +0200 | [diff] [blame] | 70 | #include "webrtc/base/rtccertificate.h" |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 71 | #include "webrtc/base/socketaddress.h" |
kjellander | a96e2d7 | 2016-02-04 23:52:28 -0800 | [diff] [blame] | 72 | #include "webrtc/base/sslstreamadapter.h" |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 73 | #include "webrtc/p2p/base/portallocator.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 74 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 75 | namespace rtc { |
jiayl@webrtc.org | 61e00b0 | 2015-03-04 22:17:38 +0000 | [diff] [blame] | 76 | class SSLIdentity; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 77 | class Thread; |
| 78 | } |
| 79 | |
| 80 | namespace cricket { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 81 | class WebRtcVideoDecoderFactory; |
| 82 | class WebRtcVideoEncoderFactory; |
| 83 | } |
| 84 | |
| 85 | namespace webrtc { |
| 86 | class AudioDeviceModule; |
| 87 | class MediaConstraintsInterface; |
| 88 | |
| 89 | // MediaStream container interface. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 90 | class StreamCollectionInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 91 | public: |
| 92 | // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. |
| 93 | virtual size_t count() = 0; |
| 94 | virtual MediaStreamInterface* at(size_t index) = 0; |
| 95 | virtual MediaStreamInterface* find(const std::string& label) = 0; |
| 96 | virtual MediaStreamTrackInterface* FindAudioTrack( |
| 97 | const std::string& id) = 0; |
| 98 | virtual MediaStreamTrackInterface* FindVideoTrack( |
| 99 | const std::string& id) = 0; |
| 100 | |
| 101 | protected: |
| 102 | // Dtor protected as objects shouldn't be deleted via this interface. |
| 103 | ~StreamCollectionInterface() {} |
| 104 | }; |
| 105 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 106 | class StatsObserver : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 107 | public: |
tommi@webrtc.org | e2e199b | 2014-12-15 13:22:54 +0000 | [diff] [blame] | 108 | virtual void OnComplete(const StatsReports& reports) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 109 | |
| 110 | protected: |
| 111 | virtual ~StatsObserver() {} |
| 112 | }; |
| 113 | |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 +0000 | [diff] [blame] | 114 | class MetricsObserverInterface : public rtc::RefCountInterface { |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 +0000 | [diff] [blame] | 115 | public: |
Guo-wei Shieh | 3d564c1 | 2015-08-19 16:51:15 -0700 | [diff] [blame] | 116 | |
| 117 | // |type| is the type of the enum counter to be incremented. |counter| |
| 118 | // is the particular counter in that type. |counter_max| is the next sequence |
| 119 | // number after the highest counter. |
| 120 | virtual void IncrementEnumCounter(PeerConnectionEnumCounterType type, |
| 121 | int counter, |
| 122 | int counter_max) {} |
| 123 | |
Guo-wei Shieh | 456696a | 2015-09-30 21:48:54 -0700 | [diff] [blame] | 124 | // This is used to handle sparse counters like SSL cipher suites. |
| 125 | // TODO(guoweis): Remove the implementation once the dependency's interface |
| 126 | // definition is updated. |
| 127 | virtual void IncrementSparseEnumCounter(PeerConnectionEnumCounterType type, |
| 128 | int counter) { |
| 129 | IncrementEnumCounter(type, counter, 0 /* Ignored */); |
| 130 | } |
| 131 | |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 +0000 | [diff] [blame] | 132 | virtual void AddHistogramSample(PeerConnectionMetricsName type, |
mallinath@webrtc.org | d37bcfa | 2014-05-12 23:10:18 +0000 | [diff] [blame] | 133 | int value) = 0; |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 +0000 | [diff] [blame] | 134 | |
| 135 | protected: |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 +0000 | [diff] [blame] | 136 | virtual ~MetricsObserverInterface() {} |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 +0000 | [diff] [blame] | 137 | }; |
| 138 | |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 +0000 | [diff] [blame] | 139 | typedef MetricsObserverInterface UMAObserver; |
| 140 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 141 | class PeerConnectionInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 142 | public: |
| 143 | // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . |
| 144 | enum SignalingState { |
| 145 | kStable, |
| 146 | kHaveLocalOffer, |
| 147 | kHaveLocalPrAnswer, |
| 148 | kHaveRemoteOffer, |
| 149 | kHaveRemotePrAnswer, |
| 150 | kClosed, |
| 151 | }; |
| 152 | |
| 153 | // TODO(bemasc): Remove IceState when callers are changed to |
| 154 | // IceConnection/GatheringState. |
| 155 | enum IceState { |
| 156 | kIceNew, |
| 157 | kIceGathering, |
| 158 | kIceWaiting, |
| 159 | kIceChecking, |
| 160 | kIceConnected, |
| 161 | kIceCompleted, |
| 162 | kIceFailed, |
| 163 | kIceClosed, |
| 164 | }; |
| 165 | |
| 166 | enum IceGatheringState { |
| 167 | kIceGatheringNew, |
| 168 | kIceGatheringGathering, |
| 169 | kIceGatheringComplete |
| 170 | }; |
| 171 | |
| 172 | enum IceConnectionState { |
| 173 | kIceConnectionNew, |
| 174 | kIceConnectionChecking, |
| 175 | kIceConnectionConnected, |
| 176 | kIceConnectionCompleted, |
| 177 | kIceConnectionFailed, |
| 178 | kIceConnectionDisconnected, |
| 179 | kIceConnectionClosed, |
Guo-wei Shieh | 3d564c1 | 2015-08-19 16:51:15 -0700 | [diff] [blame] | 180 | kIceConnectionMax, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 181 | }; |
| 182 | |
| 183 | struct IceServer { |
Joachim Bauch | 7c4e745 | 2015-05-28 23:06:30 +0200 | [diff] [blame] | 184 | // 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] | 185 | std::string uri; |
Joachim Bauch | 7c4e745 | 2015-05-28 23:06:30 +0200 | [diff] [blame] | 186 | std::vector<std::string> urls; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 187 | std::string username; |
| 188 | std::string password; |
| 189 | }; |
| 190 | typedef std::vector<IceServer> IceServers; |
| 191 | |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 192 | enum IceTransportsType { |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 193 | // TODO(pthatcher): Rename these kTransporTypeXXX, but update |
| 194 | // Chromium at the same time. |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 195 | kNone, |
| 196 | kRelay, |
| 197 | kNoHost, |
| 198 | kAll |
| 199 | }; |
| 200 | |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 201 | // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1 |
| 202 | enum BundlePolicy { |
| 203 | kBundlePolicyBalanced, |
| 204 | kBundlePolicyMaxBundle, |
| 205 | kBundlePolicyMaxCompat |
| 206 | }; |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 207 | |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 208 | // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1 |
| 209 | enum RtcpMuxPolicy { |
| 210 | kRtcpMuxPolicyNegotiate, |
| 211 | kRtcpMuxPolicyRequire, |
| 212 | }; |
| 213 | |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 214 | enum TcpCandidatePolicy { |
| 215 | kTcpCandidatePolicyEnabled, |
| 216 | kTcpCandidatePolicyDisabled |
| 217 | }; |
| 218 | |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 219 | enum ContinualGatheringPolicy { |
| 220 | GATHER_ONCE, |
| 221 | GATHER_CONTINUALLY |
| 222 | }; |
| 223 | |
Henrik Boström | 87713d0 | 2015-08-25 09:53:21 +0200 | [diff] [blame] | 224 | // TODO(hbos): Change into class with private data and public getters. |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 225 | struct RTCConfiguration { |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 226 | static const int kUndefined = -1; |
| 227 | // Default maximum number of packets in the audio jitter buffer. |
| 228 | static const int kAudioJitterBufferMaxPackets = 50; |
pthatcher@webrtc.org | fd630a5 | 2015-01-14 23:19:06 +0000 | [diff] [blame] | 229 | // TODO(pthatcher): Rename this ice_transport_type, but update |
| 230 | // Chromium at the same time. |
| 231 | IceTransportsType type; |
| 232 | // TODO(pthatcher): Rename this ice_servers, but update Chromium |
| 233 | // at the same time. |
| 234 | IceServers servers; |
| 235 | BundlePolicy bundle_policy; |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 236 | RtcpMuxPolicy rtcp_mux_policy; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 237 | TcpCandidatePolicy tcp_candidate_policy; |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 238 | int audio_jitter_buffer_max_packets; |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 239 | bool audio_jitter_buffer_fast_accelerate; |
Honghai Zhang | 381b421 | 2015-12-04 12:24:03 -0800 | [diff] [blame] | 240 | int ice_connection_receiving_timeout; // ms |
| 241 | int ice_backup_candidate_pair_ping_interval; // ms |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 242 | ContinualGatheringPolicy continual_gathering_policy; |
Henrik Boström | 87713d0 | 2015-08-25 09:53:21 +0200 | [diff] [blame] | 243 | std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates; |
qiangchen | 444682a | 2015-11-24 18:07:56 -0800 | [diff] [blame] | 244 | bool disable_prerenderer_smoothing; |
guoweis | 36f0137 | 2016-03-02 18:02:40 -0800 | [diff] [blame] | 245 | bool prioritize_most_likely_ice_candidate_pairs; |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 246 | // Flags corresponding to values set by constraint flags. |
| 247 | // rtc::Optional flags can be "missing", in which case the webrtc |
| 248 | // default applies. |
| 249 | bool disable_ipv6; |
| 250 | rtc::Optional<bool> enable_dscp; |
| 251 | bool enable_rtp_data_channel; |
| 252 | rtc::Optional<bool> cpu_overuse_detection; |
| 253 | rtc::Optional<bool> suspend_below_min_bitrate; |
| 254 | rtc::Optional<int> screencast_min_bitrate; |
| 255 | rtc::Optional<bool> combined_audio_video_bwe; |
| 256 | rtc::Optional<bool> enable_dtls_srtp; |
Jiayang Liu | cac1b38 | 2015-04-30 12:35:24 -0700 | [diff] [blame] | 257 | RTCConfiguration() |
| 258 | : type(kAll), |
| 259 | bundle_policy(kBundlePolicyBalanced), |
Peter Thatcher | af55ccc | 2015-05-21 07:48:41 -0700 | [diff] [blame] | 260 | rtcp_mux_policy(kRtcpMuxPolicyNegotiate), |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 261 | tcp_candidate_policy(kTcpCandidatePolicyEnabled), |
honghaiz | 4edc39c | 2015-09-01 09:53:56 -0700 | [diff] [blame] | 262 | audio_jitter_buffer_max_packets(kAudioJitterBufferMaxPackets), |
| 263 | audio_jitter_buffer_fast_accelerate(false), |
honghaiz | 1f429e3 | 2015-09-28 07:57:34 -0700 | [diff] [blame] | 264 | ice_connection_receiving_timeout(kUndefined), |
Honghai Zhang | 381b421 | 2015-12-04 12:24:03 -0800 | [diff] [blame] | 265 | ice_backup_candidate_pair_ping_interval(kUndefined), |
qiangchen | 444682a | 2015-11-24 18:07:56 -0800 | [diff] [blame] | 266 | continual_gathering_policy(GATHER_ONCE), |
guoweis | 36f0137 | 2016-03-02 18:02:40 -0800 | [diff] [blame] | 267 | disable_prerenderer_smoothing(false), |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 268 | prioritize_most_likely_ice_candidate_pairs(false), |
| 269 | disable_ipv6(false), |
| 270 | enable_rtp_data_channel(false) {} |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 271 | }; |
| 272 | |
jiayl@webrtc.org | b18bf5e | 2014-08-04 18:34:16 +0000 | [diff] [blame] | 273 | struct RTCOfferAnswerOptions { |
| 274 | static const int kUndefined = -1; |
| 275 | static const int kMaxOfferToReceiveMedia = 1; |
| 276 | |
| 277 | // The default value for constraint offerToReceiveX:true. |
| 278 | static const int kOfferToReceiveMediaTrue = 1; |
| 279 | |
| 280 | int offer_to_receive_video; |
| 281 | int offer_to_receive_audio; |
| 282 | bool voice_activity_detection; |
| 283 | bool ice_restart; |
| 284 | bool use_rtp_mux; |
| 285 | |
| 286 | RTCOfferAnswerOptions() |
| 287 | : offer_to_receive_video(kUndefined), |
| 288 | offer_to_receive_audio(kUndefined), |
| 289 | voice_activity_detection(true), |
| 290 | ice_restart(false), |
| 291 | use_rtp_mux(true) {} |
| 292 | |
| 293 | RTCOfferAnswerOptions(int offer_to_receive_video, |
| 294 | int offer_to_receive_audio, |
| 295 | bool voice_activity_detection, |
| 296 | bool ice_restart, |
| 297 | bool use_rtp_mux) |
| 298 | : offer_to_receive_video(offer_to_receive_video), |
| 299 | offer_to_receive_audio(offer_to_receive_audio), |
| 300 | voice_activity_detection(voice_activity_detection), |
| 301 | ice_restart(ice_restart), |
| 302 | use_rtp_mux(use_rtp_mux) {} |
| 303 | }; |
| 304 | |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 305 | // Used by GetStats to decide which stats to include in the stats reports. |
| 306 | // |kStatsOutputLevelStandard| includes the standard stats for Javascript API; |
| 307 | // |kStatsOutputLevelDebug| includes both the standard stats and additional |
| 308 | // stats for debugging purposes. |
| 309 | enum StatsOutputLevel { |
| 310 | kStatsOutputLevelStandard, |
| 311 | kStatsOutputLevelDebug, |
| 312 | }; |
| 313 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 314 | // Accessor methods to active local streams. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 315 | virtual rtc::scoped_refptr<StreamCollectionInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 316 | local_streams() = 0; |
| 317 | |
| 318 | // Accessor methods to remote streams. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 319 | virtual rtc::scoped_refptr<StreamCollectionInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 320 | remote_streams() = 0; |
| 321 | |
| 322 | // Add a new MediaStream to be sent on this PeerConnection. |
| 323 | // Note that a SessionDescription negotiation is needed before the |
| 324 | // remote peer can receive the stream. |
perkj@webrtc.org | fd0efb6 | 2014-11-06 12:16:36 +0000 | [diff] [blame] | 325 | virtual bool AddStream(MediaStreamInterface* stream) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 326 | |
| 327 | // Remove a MediaStream from this PeerConnection. |
| 328 | // Note that a SessionDescription negotiation is need before the |
| 329 | // remote peer is notified. |
| 330 | virtual void RemoveStream(MediaStreamInterface* stream) = 0; |
| 331 | |
deadbeef | e1f9d83 | 2016-01-14 15:35:42 -0800 | [diff] [blame] | 332 | // TODO(deadbeef): Make the following two methods pure virtual once |
| 333 | // implemented by all subclasses of PeerConnectionInterface. |
| 334 | // Add a new MediaStreamTrack to be sent on this PeerConnection. |
| 335 | // |streams| indicates which stream labels the track should be associated |
| 336 | // with. |
| 337 | virtual rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
| 338 | MediaStreamTrackInterface* track, |
| 339 | std::vector<MediaStreamInterface*> streams) { |
| 340 | return nullptr; |
| 341 | } |
| 342 | |
| 343 | // Remove an RtpSender from this PeerConnection. |
| 344 | // Returns true on success. |
| 345 | virtual bool RemoveTrack(RtpSenderInterface* sender) { |
| 346 | return false; |
| 347 | } |
| 348 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 349 | // Returns pointer to the created DtmfSender on success. |
| 350 | // Otherwise returns NULL. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 351 | virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 352 | AudioTrackInterface* track) = 0; |
| 353 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 354 | // TODO(deadbeef): Make these pure virtual once all subclasses implement them. |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 355 | // |kind| must be "audio" or "video". |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 356 | // |stream_id| is used to populate the msid attribute; if empty, one will |
| 357 | // be generated automatically. |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 358 | virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender( |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 359 | const std::string& kind, |
| 360 | const std::string& stream_id) { |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 361 | return rtc::scoped_refptr<RtpSenderInterface>(); |
| 362 | } |
| 363 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 364 | virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders() |
| 365 | const { |
| 366 | return std::vector<rtc::scoped_refptr<RtpSenderInterface>>(); |
| 367 | } |
| 368 | |
| 369 | virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers() |
| 370 | const { |
| 371 | return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>(); |
| 372 | } |
| 373 | |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 374 | virtual bool GetStats(StatsObserver* observer, |
| 375 | MediaStreamTrackInterface* track, |
| 376 | StatsOutputLevel level) = 0; |
| 377 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 378 | virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 379 | const std::string& label, |
| 380 | const DataChannelInit* config) = 0; |
| 381 | |
| 382 | virtual const SessionDescriptionInterface* local_description() const = 0; |
| 383 | virtual const SessionDescriptionInterface* remote_description() const = 0; |
| 384 | |
| 385 | // Create a new offer. |
| 386 | // The CreateSessionDescriptionObserver callback will be called when done. |
| 387 | virtual void CreateOffer(CreateSessionDescriptionObserver* observer, |
jiayl@webrtc.org | b18bf5e | 2014-08-04 18:34:16 +0000 | [diff] [blame] | 388 | const MediaConstraintsInterface* constraints) {} |
| 389 | |
| 390 | // TODO(jiayl): remove the default impl and the old interface when chromium |
| 391 | // code is updated. |
| 392 | virtual void CreateOffer(CreateSessionDescriptionObserver* observer, |
| 393 | const RTCOfferAnswerOptions& options) {} |
| 394 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 395 | // Create an answer to an offer. |
| 396 | // The CreateSessionDescriptionObserver callback will be called when done. |
| 397 | virtual void CreateAnswer(CreateSessionDescriptionObserver* observer, |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 398 | const RTCOfferAnswerOptions& options) {} |
| 399 | // Deprecated - use version above. |
| 400 | // TODO(hta): Remove and remove default implementations when all callers |
| 401 | // are updated. |
| 402 | virtual void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 403 | const MediaConstraintsInterface* constraints) {} |
| 404 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 405 | // Sets the local session description. |
| 406 | // JsepInterface takes the ownership of |desc| even if it fails. |
| 407 | // The |observer| callback will be called when done. |
| 408 | virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, |
| 409 | SessionDescriptionInterface* desc) = 0; |
| 410 | // Sets the remote session description. |
| 411 | // JsepInterface takes the ownership of |desc| even if it fails. |
| 412 | // The |observer| callback will be called when done. |
| 413 | virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
| 414 | SessionDescriptionInterface* desc) = 0; |
| 415 | // Restarts or updates the ICE Agent process of gathering local candidates |
| 416 | // and pinging remote candidates. |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 417 | // TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 418 | virtual bool UpdateIce(const IceServers& configuration, |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 419 | const MediaConstraintsInterface* constraints) { |
| 420 | return false; |
| 421 | } |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 422 | virtual bool UpdateIce(const IceServers& configuration) { return false; } |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 423 | // Sets the PeerConnection's global configuration to |config|. |
| 424 | // Any changes to STUN/TURN servers or ICE candidate policy will affect the |
| 425 | // next gathering phase, and cause the next call to createOffer to generate |
| 426 | // new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies |
| 427 | // cannot be changed with this method. |
| 428 | // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of |
| 429 | // PeerConnectionInterface implement it. |
| 430 | virtual bool SetConfiguration( |
| 431 | const PeerConnectionInterface::RTCConfiguration& config) { |
| 432 | return false; |
| 433 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 434 | // Provides a remote candidate to the ICE Agent. |
| 435 | // A copy of the |candidate| will be created and added to the remote |
| 436 | // description. So the caller of this method still has the ownership of the |
| 437 | // |candidate|. |
| 438 | // TODO(ronghuawu): Consider to change this so that the AddIceCandidate will |
| 439 | // take the ownership of the |candidate|. |
| 440 | virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0; |
| 441 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 +0000 | [diff] [blame] | 442 | virtual void RegisterUMAObserver(UMAObserver* observer) = 0; |
| 443 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 444 | // Returns the current SignalingState. |
| 445 | virtual SignalingState signaling_state() = 0; |
| 446 | |
| 447 | // TODO(bemasc): Remove ice_state when callers are changed to |
| 448 | // IceConnection/GatheringState. |
| 449 | // Returns the current IceState. |
| 450 | virtual IceState ice_state() = 0; |
| 451 | virtual IceConnectionState ice_connection_state() = 0; |
| 452 | virtual IceGatheringState ice_gathering_state() = 0; |
| 453 | |
| 454 | // Terminates all media and closes the transport. |
| 455 | virtual void Close() = 0; |
| 456 | |
| 457 | protected: |
| 458 | // Dtor protected as objects shouldn't be deleted via this interface. |
| 459 | ~PeerConnectionInterface() {} |
| 460 | }; |
| 461 | |
| 462 | // PeerConnection callback interface. Application should implement these |
| 463 | // methods. |
| 464 | class PeerConnectionObserver { |
| 465 | public: |
| 466 | enum StateType { |
| 467 | kSignalingState, |
| 468 | kIceState, |
| 469 | }; |
| 470 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 471 | // Triggered when the SignalingState changed. |
| 472 | virtual void OnSignalingChange( |
perkj | dfb769d | 2016-02-09 03:09:43 -0800 | [diff] [blame] | 473 | PeerConnectionInterface::SignalingState new_state) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 474 | |
| 475 | // Triggered when media is received on a new stream from remote peer. |
| 476 | virtual void OnAddStream(MediaStreamInterface* stream) = 0; |
| 477 | |
| 478 | // Triggered when a remote peer close a stream. |
| 479 | virtual void OnRemoveStream(MediaStreamInterface* stream) = 0; |
| 480 | |
| 481 | // Triggered when a remote peer open a data channel. |
perkj@webrtc.org | c2dd5ee | 2014-11-04 11:31:29 +0000 | [diff] [blame] | 482 | virtual void OnDataChannel(DataChannelInterface* data_channel) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 483 | |
mallinath@webrtc.org | 0d92ef6 | 2014-01-22 02:21:22 +0000 | [diff] [blame] | 484 | // Triggered when renegotiation is needed, for example the ICE has restarted. |
fischman@webrtc.org | d7568a0 | 2014-01-13 22:04:12 +0000 | [diff] [blame] | 485 | virtual void OnRenegotiationNeeded() = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 486 | |
| 487 | // Called any time the IceConnectionState changes |
| 488 | virtual void OnIceConnectionChange( |
perkj | dfb769d | 2016-02-09 03:09:43 -0800 | [diff] [blame] | 489 | PeerConnectionInterface::IceConnectionState new_state) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 490 | |
| 491 | // Called any time the IceGatheringState changes |
| 492 | virtual void OnIceGatheringChange( |
perkj | dfb769d | 2016-02-09 03:09:43 -0800 | [diff] [blame] | 493 | PeerConnectionInterface::IceGatheringState new_state) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 494 | |
| 495 | // New Ice candidate have been found. |
| 496 | virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; |
| 497 | |
Peter Thatcher | 5436051 | 2015-07-08 11:08:35 -0700 | [diff] [blame] | 498 | // Called when the ICE connection receiving status changes. |
| 499 | virtual void OnIceConnectionReceivingChange(bool receiving) {} |
| 500 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 501 | protected: |
| 502 | // Dtor protected as objects shouldn't be deleted via this interface. |
| 503 | ~PeerConnectionObserver() {} |
| 504 | }; |
| 505 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 506 | // PeerConnectionFactoryInterface is the factory interface use for creating |
| 507 | // PeerConnection, MediaStream and media tracks. |
| 508 | // PeerConnectionFactoryInterface will create required libjingle threads, |
| 509 | // socket and network manager factory classes for networking. |
| 510 | // If an application decides to provide its own threads and network |
| 511 | // implementation of these classes it should use the alternate |
| 512 | // CreatePeerConnectionFactory method which accepts threads as input and use the |
Taylor Brandstetter | 0c7e9f5 | 2015-12-29 14:14:52 -0800 | [diff] [blame] | 513 | // CreatePeerConnection version that takes a PortAllocator as an |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 514 | // argument. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 515 | class PeerConnectionFactoryInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 516 | public: |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 517 | class Options { |
| 518 | public: |
Guo-wei Shieh | a7446d2 | 2016-01-11 15:27:03 -0800 | [diff] [blame] | 519 | Options() |
| 520 | : disable_encryption(false), |
| 521 | disable_sctp_data_channels(false), |
| 522 | disable_network_monitor(false), |
| 523 | network_ignore_mask(rtc::kDefaultNetworkIgnoreMask), |
| 524 | ssl_max_version(rtc::SSL_PROTOCOL_DTLS_12) {} |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 525 | bool disable_encryption; |
| 526 | bool disable_sctp_data_channels; |
honghaiz | 023f3ef | 2015-10-19 09:39:32 -0700 | [diff] [blame] | 527 | bool disable_network_monitor; |
phoglund@webrtc.org | 006521d | 2015-02-12 09:23:59 +0000 | [diff] [blame] | 528 | |
| 529 | // Sets the network types to ignore. For instance, calling this with |
| 530 | // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and |
| 531 | // loopback interfaces. |
| 532 | int network_ignore_mask; |
Joachim Bauch | 04e5b49 | 2015-05-29 09:40:39 +0200 | [diff] [blame] | 533 | |
| 534 | // Sets the maximum supported protocol version. The highest version |
| 535 | // supported by both ends will be used for the connection, i.e. if one |
| 536 | // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. |
| 537 | rtc::SSLProtocolVersion ssl_max_version; |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 538 | }; |
| 539 | |
| 540 | virtual void SetOptions(const Options& options) = 0; |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 541 | |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 542 | virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 543 | const PeerConnectionInterface::RTCConfiguration& configuration, |
| 544 | const MediaConstraintsInterface* constraints, |
| 545 | rtc::scoped_ptr<cricket::PortAllocator> allocator, |
| 546 | rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
Taylor Brandstetter | 0c7e9f5 | 2015-12-29 14:14:52 -0800 | [diff] [blame] | 547 | PeerConnectionObserver* observer) = 0; |
buildbot@webrtc.org | 41451d4 | 2014-05-03 05:39:45 +0000 | [diff] [blame] | 548 | |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 549 | virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 550 | const PeerConnectionInterface::RTCConfiguration& configuration, |
| 551 | rtc::scoped_ptr<cricket::PortAllocator> allocator, |
| 552 | rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 553 | PeerConnectionObserver* observer) = 0; |
| 554 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 555 | virtual rtc::scoped_refptr<MediaStreamInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 556 | CreateLocalMediaStream(const std::string& label) = 0; |
| 557 | |
| 558 | // Creates a AudioSourceInterface. |
| 559 | // |constraints| decides audio processing settings but can be NULL. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 560 | virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 561 | const cricket::AudioOptions& options) = 0; |
| 562 | // Deprecated - use version above. |
| 563 | virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 564 | const MediaConstraintsInterface* constraints) = 0; |
| 565 | |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame^] | 566 | // Creates a VideoTrackSourceInterface. The new source take ownership of |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 567 | // |capturer|. |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame^] | 568 | virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 569 | cricket::VideoCapturer* capturer) = 0; |
| 570 | // A video source creator that allows selection of resolution and frame rate. |
| 571 | // |constraints| decides video resolution and frame rate but can |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 572 | // be NULL. |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 573 | // In the NULL case, use the version above. |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame^] | 574 | virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 575 | cricket::VideoCapturer* capturer, |
| 576 | const MediaConstraintsInterface* constraints) = 0; |
| 577 | |
| 578 | // Creates a new local VideoTrack. The same |source| can be used in several |
| 579 | // tracks. |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame^] | 580 | virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( |
| 581 | const std::string& label, |
| 582 | VideoTrackSourceInterface* source) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 583 | |
| 584 | // Creates an new AudioTrack. At the moment |source| can be NULL. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 585 | virtual rtc::scoped_refptr<AudioTrackInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 586 | CreateAudioTrack(const std::string& label, |
| 587 | AudioSourceInterface* source) = 0; |
| 588 | |
wu@webrtc.org | a989080 | 2013-12-13 00:21:03 +0000 | [diff] [blame] | 589 | // Starts AEC dump using existing file. Takes ownership of |file| and passes |
| 590 | // it on to VoiceEngine (via other objects) immediately, which will take |
wu@webrtc.org | a8910d2 | 2014-01-23 22:12:45 +0000 | [diff] [blame] | 591 | // the ownerhip. If the operation fails, the file will be closed. |
ivoc | d66b44d | 2016-01-15 03:06:36 -0800 | [diff] [blame] | 592 | // A maximum file size in bytes can be specified. When the file size limit is |
| 593 | // reached, logging is stopped automatically. If max_size_bytes is set to a |
| 594 | // value <= 0, no limit will be used, and logging will continue until the |
| 595 | // StopAecDump function is called. |
| 596 | 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] | 597 | |
ivoc | 797ef12 | 2015-10-22 03:25:41 -0700 | [diff] [blame] | 598 | // Stops logging the AEC dump. |
| 599 | virtual void StopAecDump() = 0; |
| 600 | |
ivoc | 112a3d8 | 2015-10-16 02:22:18 -0700 | [diff] [blame] | 601 | // Starts RtcEventLog using existing file. Takes ownership of |file| and |
| 602 | // passes it on to VoiceEngine, which will take the ownership. If the |
| 603 | // operation fails the file will be closed. The logging will stop |
| 604 | // automatically after 10 minutes have passed, or when the StopRtcEventLog |
| 605 | // function is called. |
| 606 | // This function as well as the StopRtcEventLog don't really belong on this |
| 607 | // interface, this is a temporary solution until we move the logging object |
| 608 | // from inside voice engine to webrtc::Call, which will happen when the VoE |
| 609 | // restructuring effort is further along. |
| 610 | // TODO(ivoc): Move this into being: |
| 611 | // PeerConnection => MediaController => webrtc::Call. |
| 612 | virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0; |
| 613 | |
| 614 | // Stops logging the RtcEventLog. |
| 615 | virtual void StopRtcEventLog() = 0; |
| 616 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 617 | protected: |
| 618 | // Dtor and ctor protected as objects shouldn't be created or deleted via |
| 619 | // this interface. |
| 620 | PeerConnectionFactoryInterface() {} |
| 621 | ~PeerConnectionFactoryInterface() {} // NOLINT |
| 622 | }; |
| 623 | |
| 624 | // Create a new instance of PeerConnectionFactoryInterface. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 625 | rtc::scoped_refptr<PeerConnectionFactoryInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 626 | CreatePeerConnectionFactory(); |
| 627 | |
| 628 | // Create a new instance of PeerConnectionFactoryInterface. |
| 629 | // Ownership of |factory|, |default_adm|, and optionally |encoder_factory| and |
| 630 | // |decoder_factory| transferred to the returned factory. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 631 | rtc::scoped_refptr<PeerConnectionFactoryInterface> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 632 | CreatePeerConnectionFactory( |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 633 | rtc::Thread* worker_thread, |
| 634 | rtc::Thread* signaling_thread, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 635 | AudioDeviceModule* default_adm, |
| 636 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 637 | cricket::WebRtcVideoDecoderFactory* decoder_factory); |
| 638 | |
| 639 | } // namespace webrtc |
| 640 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 641 | #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |