blob: 250501fd05588f43eff2ba4976090130f334b355 [file] [log] [blame]
Zhi Huange818b6e2018-02-22 15:26:27 -08001/*
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved.
3 *
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.
9 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef PC_JSEP_TRANSPORT_CONTROLLER_H_
12#define PC_JSEP_TRANSPORT_CONTROLLER_H_
Zhi Huange818b6e2018-02-22 15:26:27 -080013
14#include <map>
15#include <memory>
16#include <string>
17#include <utility>
18#include <vector>
19
20#include "api/candidate.h"
Steve Anton10542f22019-01-11 09:11:00 -080021#include "api/crypto/crypto_options.h"
Qingsi Wang25ec8882019-11-15 12:33:05 -080022#include "api/ice_transport_factory.h"
Steve Anton10542f22019-01-11 09:11:00 -080023#include "api/peer_connection_interface.h"
Danil Chapovalov83bbe912019-08-07 12:24:53 +020024#include "api/rtc_event_log/rtc_event_log.h"
Steve Anton10542f22019-01-11 09:11:00 -080025#include "media/sctp/sctp_transport_internal.h"
26#include "p2p/base/dtls_transport.h"
Qingsi Wang25ec8882019-11-15 12:33:05 -080027#include "p2p/base/dtls_transport_factory.h"
Steve Anton10542f22019-01-11 09:11:00 -080028#include "p2p/base/p2p_transport_channel.h"
Zhi Huange818b6e2018-02-22 15:26:27 -080029#include "pc/channel.h"
Steve Anton10542f22019-01-11 09:11:00 -080030#include "pc/dtls_srtp_transport.h"
31#include "pc/dtls_transport.h"
32#include "pc/jsep_transport.h"
33#include "pc/rtp_transport.h"
34#include "pc/srtp_transport.h"
35#include "rtc_base/async_invoker.h"
36#include "rtc_base/constructor_magic.h"
37#include "rtc_base/ref_counted_object.h"
Artem Titove41c4332018-07-25 15:04:28 +020038#include "rtc_base/third_party/sigslot/sigslot.h"
Zhi Huange818b6e2018-02-22 15:26:27 -080039
40namespace rtc {
41class Thread;
42class PacketTransportInternal;
43} // namespace rtc
44
45namespace webrtc {
46
Steve Antond25828a2018-08-31 13:06:05 -070047class JsepTransportController : public sigslot::has_slots<> {
Zhi Huange818b6e2018-02-22 15:26:27 -080048 public:
Zhi Huang365381f2018-04-13 16:44:34 -070049 // Used when the RtpTransport/DtlsTransport of the m= section is changed
50 // because the section is rejected or BUNDLE is enabled.
51 class Observer {
52 public:
53 virtual ~Observer() {}
54
55 // Returns true if media associated with |mid| was successfully set up to be
56 // demultiplexed on |rtp_transport|. Could return false if two bundled m=
57 // sections use the same SSRC, for example.
Bjorn A Mellemb689af42019-08-21 10:44:59 -070058 //
59 // If a data channel transport must be negotiated, |data_channel_transport|
60 // and |negotiation_state| indicate negotiation status. If
61 // |data_channel_transport| is null, the data channel transport should not
62 // be used. Otherwise, the value is a pointer to the transport to be used
63 // for data channels on |mid|, if any.
64 //
65 // The observer should not send data on |data_channel_transport| until
66 // |negotiation_state| is provisional or final. It should not delete
67 // |data_channel_transport| or any fallback transport until
68 // |negotiation_state| is final.
Taylor Brandstettercbaa2542018-04-16 16:42:14 -070069 virtual bool OnTransportChanged(
Zhi Huang365381f2018-04-13 16:44:34 -070070 const std::string& mid,
Taylor Brandstettercbaa2542018-04-16 16:42:14 -070071 RtpTransportInternal* rtp_transport,
Harald Alvestrandc85328f2019-02-28 07:51:00 +010072 rtc::scoped_refptr<DtlsTransport> dtls_transport,
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -070073 DataChannelTransportInterface* data_channel_transport) = 0;
Zhi Huang365381f2018-04-13 16:44:34 -070074 };
75
Zhi Huange818b6e2018-02-22 15:26:27 -080076 struct Config {
77 // If |redetermine_role_on_ice_restart| is true, ICE role is redetermined
78 // upon setting a local transport description that indicates an ICE
79 // restart.
80 bool redetermine_role_on_ice_restart = true;
81 rtc::SSLProtocolVersion ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
82 // |crypto_options| is used to determine if created DTLS transports
83 // negotiate GCM crypto suites or not.
Benjamin Wrighta54daf12018-10-11 15:33:17 -070084 webrtc::CryptoOptions crypto_options;
Zhi Huange818b6e2018-02-22 15:26:27 -080085 PeerConnectionInterface::BundlePolicy bundle_policy =
86 PeerConnectionInterface::kBundlePolicyBalanced;
87 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy =
88 PeerConnectionInterface::kRtcpMuxPolicyRequire;
89 bool disable_encryption = false;
90 bool enable_external_auth = false;
91 // Used to inject the ICE/DTLS transports created externally.
Qingsi Wang25ec8882019-11-15 12:33:05 -080092 webrtc::IceTransportFactory* ice_transport_factory = nullptr;
93 cricket::DtlsTransportFactory* dtls_transport_factory = nullptr;
Zhi Huang365381f2018-04-13 16:44:34 -070094 Observer* transport_observer = nullptr;
Sebastian Jansson1b83a9e2019-09-18 18:22:12 +020095 // Must be provided and valid for the lifetime of the
96 // JsepTransportController instance.
97 std::function<void(const rtc::CopyOnWriteBuffer& packet,
98 int64_t packet_time_us)>
99 rtcp_handler;
Zhi Huangb57e1692018-06-12 11:41:11 -0700100 bool active_reset_srtp_params = false;
Qingsi Wang7685e862018-06-11 20:15:46 -0700101 RtcEventLog* event_log = nullptr;
Anton Sukhanov7940da02018-10-10 10:34:49 -0700102
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -0700103 // Factory for SCTP transports.
104 cricket::SctpTransportInternalFactory* sctp_factory = nullptr;
Zhi Huange818b6e2018-02-22 15:26:27 -0800105 };
106
107 // The ICE related events are signaled on the |signaling_thread|.
108 // All the transport related methods are called on the |network_thread|.
109 JsepTransportController(rtc::Thread* signaling_thread,
110 rtc::Thread* network_thread,
111 cricket::PortAllocator* port_allocator,
Zach Steine20867f2018-08-02 13:20:15 -0700112 AsyncResolverFactory* async_resolver_factory,
Zhi Huange818b6e2018-02-22 15:26:27 -0800113 Config config);
114 virtual ~JsepTransportController();
115
116 // The main method to be called; applies a description at the transport
117 // level, creating/destroying transport objects as needed and updating their
118 // properties. This includes RTP, DTLS, and ICE (but not SCTP). At least not
119 // yet? May make sense to in the future.
120 RTCError SetLocalDescription(SdpType type,
121 const cricket::SessionDescription* description);
122
123 RTCError SetRemoteDescription(SdpType type,
124 const cricket::SessionDescription* description);
125
126 // Get transports to be used for the provided |mid|. If bundling is enabled,
127 // calling GetRtpTransport for multiple MIDs may yield the same object.
128 RtpTransportInternal* GetRtpTransport(const std::string& mid) const;
Harald Alvestrandad88c882018-11-28 16:47:46 +0100129 cricket::DtlsTransportInternal* GetDtlsTransport(const std::string& mid);
130 const cricket::DtlsTransportInternal* GetRtcpDtlsTransport(
Zhi Huange818b6e2018-02-22 15:26:27 -0800131 const std::string& mid) const;
Harald Alvestrandad88c882018-11-28 16:47:46 +0100132 // Gets the externally sharable version of the DtlsTransport.
Harald Alvestrand4a7b3ac2019-01-17 10:39:40 +0100133 rtc::scoped_refptr<webrtc::DtlsTransport> LookupDtlsTransportByMid(
Harald Alvestrandad88c882018-11-28 16:47:46 +0100134 const std::string& mid);
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -0700135 rtc::scoped_refptr<SctpTransport> GetSctpTransport(
136 const std::string& mid) const;
Zhi Huange818b6e2018-02-22 15:26:27 -0800137
Bjorn A Mellemb689af42019-08-21 10:44:59 -0700138 DataChannelTransportInterface* GetDataChannelTransport(
Anton Sukhanov316f3ac2019-05-23 15:50:38 -0700139 const std::string& mid) const;
140
Zhi Huange818b6e2018-02-22 15:26:27 -0800141 /*********************
142 * ICE-related methods
143 ********************/
144 // This method is public to allow PeerConnection to update it from
145 // SetConfiguration.
146 void SetIceConfig(const cricket::IceConfig& config);
147 // Set the "needs-ice-restart" flag as described in JSEP. After the flag is
148 // set, offers should generate new ufrags/passwords until an ICE restart
149 // occurs.
150 void SetNeedsIceRestartFlag();
151 // Returns true if the ICE restart flag above was set, and no ICE restart has
152 // occurred yet for this transport (by applying a local description with
153 // changed ufrag/password). If the transport has been deleted as a result of
154 // bundling, returns false.
155 bool NeedsIceRestart(const std::string& mid) const;
156 // Start gathering candidates for any new transports, or transports doing an
157 // ICE restart.
158 void MaybeStartGathering();
159 RTCError AddRemoteCandidates(
160 const std::string& mid,
161 const std::vector<cricket::Candidate>& candidates);
162 RTCError RemoveRemoteCandidates(
163 const std::vector<cricket::Candidate>& candidates);
164
165 /**********************
166 * DTLS-related methods
167 *********************/
168 // Specifies the identity to use in this session.
169 // Can only be called once.
170 bool SetLocalCertificate(
171 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
172 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate(
173 const std::string& mid) const;
Taylor Brandstetterc3928662018-02-23 13:04:51 -0800174 // Caller owns returned certificate chain. This method mainly exists for
175 // stats reporting.
176 std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
Zhi Huange818b6e2018-02-22 15:26:27 -0800177 const std::string& mid) const;
178 // Get negotiated role, if one has been negotiated.
Danil Chapovalov66cadcc2018-06-19 16:47:43 +0200179 absl::optional<rtc::SSLRole> GetDtlsRole(const std::string& mid) const;
Zhi Huange818b6e2018-02-22 15:26:27 -0800180
181 // TODO(deadbeef): GetStats isn't const because all the way down to
182 // OpenSSLStreamAdapter, GetSslCipherSuite and GetDtlsSrtpCryptoSuite are not
183 // const. Fix this.
184 bool GetStats(const std::string& mid, cricket::TransportStats* stats);
Zhi Huange818b6e2018-02-22 15:26:27 -0800185
Zhi Huange830e682018-03-30 10:48:35 -0700186 bool initial_offerer() const { return initial_offerer_ && *initial_offerer_; }
Zhi Huang365381f2018-04-13 16:44:34 -0700187
Zhi Huangb57e1692018-06-12 11:41:11 -0700188 void SetActiveResetSrtpParams(bool active_reset_srtp_params);
189
Eldar Rellod85ea752020-02-19 20:41:07 +0200190 // For now the rollback only removes mid to transport mappings
Eldar Rello353a7182019-11-25 18:49:44 +0200191 // and deletes unused transports, but doesn't consider anything more complex.
Eldar Rellod85ea752020-02-19 20:41:07 +0200192 void RollbackTransports();
Eldar Rello5ab79e62019-10-09 18:29:44 +0300193
Zhi Huange818b6e2018-02-22 15:26:27 -0800194 // All of these signals are fired on the signaling thread.
195
196 // If any transport failed => failed,
197 // Else if all completed => completed,
198 // Else if all connected => connected,
199 // Else => connecting
Alex Loiko9289eda2018-11-23 16:18:59 +0000200 sigslot::signal1<cricket::IceConnectionState> SignalIceConnectionState;
Zhi Huange818b6e2018-02-22 15:26:27 -0800201
Jonas Olsson635474e2018-10-18 15:58:17 +0200202 sigslot::signal1<PeerConnectionInterface::PeerConnectionState>
203 SignalConnectionState;
Alex Loiko9289eda2018-11-23 16:18:59 +0000204 sigslot::signal1<PeerConnectionInterface::IceConnectionState>
205 SignalStandardizedIceConnectionState;
Jonas Olsson635474e2018-10-18 15:58:17 +0200206
Zhi Huange818b6e2018-02-22 15:26:27 -0800207 // If all transports done gathering => complete,
208 // Else if any are gathering => gathering,
209 // Else => new
210 sigslot::signal1<cricket::IceGatheringState> SignalIceGatheringState;
211
212 // (mid, candidates)
213 sigslot::signal2<const std::string&, const std::vector<cricket::Candidate>&>
214 SignalIceCandidatesGathered;
215
Eldar Relloda13ea22019-06-01 12:23:43 +0300216 sigslot::signal1<const cricket::IceCandidateErrorEvent&>
217 SignalIceCandidateError;
218
Zhi Huange818b6e2018-02-22 15:26:27 -0800219 sigslot::signal1<const std::vector<cricket::Candidate>&>
220 SignalIceCandidatesRemoved;
221
Alex Drake00c7ecf2019-08-06 10:54:47 -0700222 sigslot::signal1<const cricket::CandidatePairChangeEvent&>
223 SignalIceCandidatePairChanged;
224
Zhi Huange818b6e2018-02-22 15:26:27 -0800225 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError;
226
Zhi Huange818b6e2018-02-22 15:26:27 -0800227 private:
Zhi Huange818b6e2018-02-22 15:26:27 -0800228 RTCError ApplyDescription_n(bool local,
229 SdpType type,
230 const cricket::SessionDescription* description);
Zhi Huangd2248f82018-04-10 14:41:03 -0700231 RTCError ValidateAndMaybeUpdateBundleGroup(
232 bool local,
233 SdpType type,
234 const cricket::SessionDescription* description);
Zhi Huange830e682018-03-30 10:48:35 -0700235 RTCError ValidateContent(const cricket::ContentInfo& content_info);
Zhi Huange818b6e2018-02-22 15:26:27 -0800236
Taylor Brandstettercbaa2542018-04-16 16:42:14 -0700237 void HandleRejectedContent(const cricket::ContentInfo& content_info,
Zhi Huangd2248f82018-04-10 14:41:03 -0700238 const cricket::SessionDescription* description);
Zhi Huang365381f2018-04-13 16:44:34 -0700239 bool HandleBundledContent(const cricket::ContentInfo& content_info);
Zhi Huange818b6e2018-02-22 15:26:27 -0800240
Zhi Huang365381f2018-04-13 16:44:34 -0700241 bool SetTransportForMid(const std::string& mid,
Taylor Brandstettercbaa2542018-04-16 16:42:14 -0700242 cricket::JsepTransport* jsep_transport);
243 void RemoveTransportForMid(const std::string& mid);
Zhi Huangd2248f82018-04-10 14:41:03 -0700244
Zhi Huange818b6e2018-02-22 15:26:27 -0800245 cricket::JsepTransportDescription CreateJsepTransportDescription(
Harald Alvestrand1716d392019-06-03 20:35:45 +0200246 const cricket::ContentInfo& content_info,
247 const cricket::TransportInfo& transport_info,
Zhi Huange830e682018-03-30 10:48:35 -0700248 const std::vector<int>& encrypted_extension_ids,
Niels Möllerdc80aaf2020-06-18 10:10:17 +0200249 int rtp_abs_sendtime_extn_id);
Zhi Huange818b6e2018-02-22 15:26:27 -0800250
Danil Chapovalov66cadcc2018-06-19 16:47:43 +0200251 absl::optional<std::string> bundled_mid() const {
252 absl::optional<std::string> bundled_mid;
Taylor Brandstetter0ab56512018-04-12 10:30:48 -0700253 if (bundle_group_ && bundle_group_->FirstContentName()) {
254 bundled_mid = *(bundle_group_->FirstContentName());
Zhi Huange818b6e2018-02-22 15:26:27 -0800255 }
256 return bundled_mid;
257 }
258
259 bool IsBundled(const std::string& mid) const {
260 return bundle_group_ && bundle_group_->HasContentName(mid);
261 }
262
263 bool ShouldUpdateBundleGroup(SdpType type,
264 const cricket::SessionDescription* description);
265
266 std::vector<int> MergeEncryptedHeaderExtensionIdsForBundle(
267 const cricket::SessionDescription* description);
Zhi Huange818b6e2018-02-22 15:26:27 -0800268 std::vector<int> GetEncryptedHeaderExtensionIds(
269 const cricket::ContentInfo& content_info);
270
Zhi Huange830e682018-03-30 10:48:35 -0700271 int GetRtpAbsSendTimeHeaderExtensionId(
272 const cricket::ContentInfo& content_info);
Zhi Huange818b6e2018-02-22 15:26:27 -0800273
Zhi Huange830e682018-03-30 10:48:35 -0700274 // This method takes the BUNDLE group into account. If the JsepTransport is
275 // destroyed because of BUNDLE, it would return the transport which other
276 // transports are bundled on (In current implementation, it is the first
277 // content in the BUNDLE group).
Zhi Huang365381f2018-04-13 16:44:34 -0700278 const cricket::JsepTransport* GetJsepTransportForMid(
Zhi Huange830e682018-03-30 10:48:35 -0700279 const std::string& mid) const;
Zhi Huang365381f2018-04-13 16:44:34 -0700280 cricket::JsepTransport* GetJsepTransportForMid(const std::string& mid);
Zhi Huange830e682018-03-30 10:48:35 -0700281
282 // Get the JsepTransport without considering the BUNDLE group. Return nullptr
283 // if the JsepTransport is destroyed.
Zhi Huang365381f2018-04-13 16:44:34 -0700284 const cricket::JsepTransport* GetJsepTransportByName(
Zhi Huange830e682018-03-30 10:48:35 -0700285 const std::string& transport_name) const;
Zhi Huang365381f2018-04-13 16:44:34 -0700286 cricket::JsepTransport* GetJsepTransportByName(
Zhi Huange830e682018-03-30 10:48:35 -0700287 const std::string& transport_name);
288
Anton Sukhanov7940da02018-10-10 10:34:49 -0700289 // Creates jsep transport. Noop if transport is already created.
290 // Transport is created either during SetLocalDescription (|local| == true) or
291 // during SetRemoteDescription (|local| == false). Passing |local| helps to
292 // differentiate initiator (caller) from answerer (callee).
Piotr (Peter) Slatala105ded32019-02-27 14:26:15 -0800293 RTCError MaybeCreateJsepTransport(
294 bool local,
295 const cricket::ContentInfo& content_info,
296 const cricket::SessionDescription& description);
Piotr (Peter) Slatala47dfdca2018-11-16 14:13:58 -0800297
Zhi Huange818b6e2018-02-22 15:26:27 -0800298 void MaybeDestroyJsepTransport(const std::string& mid);
299 void DestroyAllJsepTransports_n();
300
301 void SetIceRole_n(cricket::IceRole ice_role);
302
303 cricket::IceRole DetermineIceRole(
Zhi Huang365381f2018-04-13 16:44:34 -0700304 cricket::JsepTransport* jsep_transport,
Zhi Huange818b6e2018-02-22 15:26:27 -0800305 const cricket::TransportInfo& transport_info,
306 SdpType type,
307 bool local);
308
309 std::unique_ptr<cricket::DtlsTransportInternal> CreateDtlsTransport(
Anton Sukhanovac6c0962019-07-10 15:44:56 -0700310 const cricket::ContentInfo& content_info,
Niels Möller2a707032020-06-16 16:39:13 +0200311 cricket::IceTransportInternal* ice);
Qingsi Wang25ec8882019-11-15 12:33:05 -0800312 rtc::scoped_refptr<webrtc::IceTransportInterface> CreateIceTransport(
313 const std::string& transport_name,
Zhi Huange818b6e2018-02-22 15:26:27 -0800314 bool rtcp);
315
316 std::unique_ptr<webrtc::RtpTransport> CreateUnencryptedRtpTransport(
317 const std::string& transport_name,
318 rtc::PacketTransportInternal* rtp_packet_transport,
319 rtc::PacketTransportInternal* rtcp_packet_transport);
320 std::unique_ptr<webrtc::SrtpTransport> CreateSdesTransport(
321 const std::string& transport_name,
Zhi Huange830e682018-03-30 10:48:35 -0700322 cricket::DtlsTransportInternal* rtp_dtls_transport,
323 cricket::DtlsTransportInternal* rtcp_dtls_transport);
Zhi Huange818b6e2018-02-22 15:26:27 -0800324 std::unique_ptr<webrtc::DtlsSrtpTransport> CreateDtlsSrtpTransport(
325 const std::string& transport_name,
326 cricket::DtlsTransportInternal* rtp_dtls_transport,
327 cricket::DtlsTransportInternal* rtcp_dtls_transport);
328
329 // Collect all the DtlsTransports, including RTP and RTCP, from the
330 // JsepTransports. JsepTransportController can iterate all the DtlsTransports
331 // and update the aggregate states.
332 std::vector<cricket::DtlsTransportInternal*> GetDtlsTransports();
333
334 // Handlers for signals from Transport.
335 void OnTransportWritableState_n(rtc::PacketTransportInternal* transport);
336 void OnTransportReceivingState_n(rtc::PacketTransportInternal* transport);
337 void OnTransportGatheringState_n(cricket::IceTransportInternal* transport);
338 void OnTransportCandidateGathered_n(cricket::IceTransportInternal* transport,
339 const cricket::Candidate& candidate);
Eldar Relloda13ea22019-06-01 12:23:43 +0300340 void OnTransportCandidateError_n(
341 cricket::IceTransportInternal* transport,
342 const cricket::IceCandidateErrorEvent& event);
Zhi Huange818b6e2018-02-22 15:26:27 -0800343 void OnTransportCandidatesRemoved_n(cricket::IceTransportInternal* transport,
344 const cricket::Candidates& candidates);
345 void OnTransportRoleConflict_n(cricket::IceTransportInternal* transport);
346 void OnTransportStateChanged_n(cricket::IceTransportInternal* transport);
Alex Drake00c7ecf2019-08-06 10:54:47 -0700347 void OnTransportCandidatePairChanged_n(
348 const cricket::CandidatePairChangeEvent& event);
Bjorn A Mellemb689af42019-08-21 10:44:59 -0700349 void OnDataChannelTransportNegotiated_n(
350 cricket::JsepTransport* transport,
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -0700351 DataChannelTransportInterface* data_channel_transport);
Zhi Huange818b6e2018-02-22 15:26:27 -0800352
353 void UpdateAggregateStates_n();
354
Sebastian Jansson1b83a9e2019-09-18 18:22:12 +0200355 void OnRtcpPacketReceived_n(rtc::CopyOnWriteBuffer* packet,
356 int64_t packet_time_us);
357
Zhi Huange818b6e2018-02-22 15:26:27 -0800358 void OnDtlsHandshakeError(rtc::SSLHandshakeError error);
359
360 rtc::Thread* const signaling_thread_ = nullptr;
361 rtc::Thread* const network_thread_ = nullptr;
362 cricket::PortAllocator* const port_allocator_ = nullptr;
Zach Steine20867f2018-08-02 13:20:15 -0700363 AsyncResolverFactory* const async_resolver_factory_ = nullptr;
Zhi Huange818b6e2018-02-22 15:26:27 -0800364
Zhi Huang365381f2018-04-13 16:44:34 -0700365 std::map<std::string, std::unique_ptr<cricket::JsepTransport>>
Zhi Huange830e682018-03-30 10:48:35 -0700366 jsep_transports_by_name_;
Zhi Huangd2248f82018-04-10 14:41:03 -0700367 // This keeps track of the mapping between media section
Zhi Huang365381f2018-04-13 16:44:34 -0700368 // (BaseChannel/SctpTransport) and the JsepTransport underneath.
369 std::map<std::string, cricket::JsepTransport*> mid_to_transport_;
Eldar Rellod85ea752020-02-19 20:41:07 +0200370 // Keep track of mids that have been mapped to transports. Used for rollback.
371 std::vector<std::string> pending_mids_ RTC_GUARDED_BY(network_thread_);
Jonas Olsson635474e2018-10-18 15:58:17 +0200372 // Aggregate states for Transports.
Alex Loiko9289eda2018-11-23 16:18:59 +0000373 // standardized_ice_connection_state_ is intended to replace
374 // ice_connection_state, see bugs.webrtc.org/9308
375 cricket::IceConnectionState ice_connection_state_ =
376 cricket::kIceConnectionConnecting;
377 PeerConnectionInterface::IceConnectionState
378 standardized_ice_connection_state_ =
379 PeerConnectionInterface::kIceConnectionNew;
Jonas Olsson635474e2018-10-18 15:58:17 +0200380 PeerConnectionInterface::PeerConnectionState combined_connection_state_ =
381 PeerConnectionInterface::PeerConnectionState::kNew;
Zhi Huange818b6e2018-02-22 15:26:27 -0800382 cricket::IceGatheringState ice_gathering_state_ = cricket::kIceGatheringNew;
383
384 Config config_;
Piotr (Peter) Slatalab1ae10b2019-03-01 11:14:05 -0800385
Zhi Huange818b6e2018-02-22 15:26:27 -0800386 const cricket::SessionDescription* local_desc_ = nullptr;
387 const cricket::SessionDescription* remote_desc_ = nullptr;
Danil Chapovalov66cadcc2018-06-19 16:47:43 +0200388 absl::optional<bool> initial_offerer_;
Zhi Huange818b6e2018-02-22 15:26:27 -0800389
Danil Chapovalov66cadcc2018-06-19 16:47:43 +0200390 absl::optional<cricket::ContentGroup> bundle_group_;
Zhi Huange818b6e2018-02-22 15:26:27 -0800391
392 cricket::IceConfig ice_config_;
393 cricket::IceRole ice_role_ = cricket::ICEROLE_CONTROLLING;
394 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64();
395 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
396 rtc::AsyncInvoker invoker_;
397
Zhi Huange818b6e2018-02-22 15:26:27 -0800398 RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransportController);
399};
400
401} // namespace webrtc
402
Steve Anton10542f22019-01-11 09:11:00 -0800403#endif // PC_JSEP_TRANSPORT_CONTROLLER_H_