Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "webrtc/p2p/base/transportcontroller.h" | 30 #include "webrtc/p2p/base/transportcontroller.h" |
| 31 #include "webrtc/pc/mediasession.h" | 31 #include "webrtc/pc/mediasession.h" |
| 32 | 32 |
| 33 #ifdef HAVE_QUIC | 33 #ifdef HAVE_QUIC |
| 34 #include "webrtc/api/quicdatatransport.h" | 34 #include "webrtc/api/quicdatatransport.h" |
| 35 #endif // HAVE_QUIC | 35 #endif // HAVE_QUIC |
| 36 | 36 |
| 37 namespace cricket { | 37 namespace cricket { |
| 38 | 38 |
| 39 class ChannelManager; | 39 class ChannelManager; |
| 40 class DataChannel; | 40 class RtpDataChannel; |
| 41 class SctpTransportInternal; | |
| 42 class SctpTransportInternalFactory; | |
| 41 class StatsReport; | 43 class StatsReport; |
| 42 class VideoChannel; | 44 class VideoChannel; |
| 43 class VoiceChannel; | 45 class VoiceChannel; |
| 44 | 46 |
| 45 #ifdef HAVE_QUIC | 47 #ifdef HAVE_QUIC |
| 46 class QuicTransportChannel; | 48 class QuicTransportChannel; |
| 47 #endif // HAVE_QUIC | 49 #endif // HAVE_QUIC |
| 48 | 50 |
| 49 } // namespace cricket | 51 } // namespace cricket |
| 50 | 52 |
| 51 namespace webrtc { | 53 namespace webrtc { |
| 52 | 54 |
| 53 class IceRestartAnswerLatch; | 55 class IceRestartAnswerLatch; |
| 54 class JsepIceCandidate; | 56 class JsepIceCandidate; |
| 55 class MediaStreamSignaling; | 57 class MediaStreamSignaling; |
| 56 class WebRtcSessionDescriptionFactory; | 58 class WebRtcSessionDescriptionFactory; |
| 57 | 59 |
| 58 extern const char kBundleWithoutRtcpMux[]; | 60 extern const char kBundleWithoutRtcpMux[]; |
| 59 extern const char kCreateChannelFailed[]; | 61 extern const char kCreateChannelFailed[]; |
| 60 extern const char kInvalidCandidates[]; | 62 extern const char kInvalidCandidates[]; |
| 61 extern const char kInvalidSdp[]; | 63 extern const char kInvalidSdp[]; |
| 62 extern const char kMlineMismatch[]; | 64 extern const char kMlineMismatch[]; |
| 63 extern const char kPushDownTDFailed[]; | 65 extern const char kPushDownTDFailed[]; |
| 64 extern const char kSdpWithoutDtlsFingerprint[]; | 66 extern const char kSdpWithoutDtlsFingerprint[]; |
| 65 extern const char kSdpWithoutSdesCrypto[]; | 67 extern const char kSdpWithoutSdesCrypto[]; |
| 66 extern const char kSdpWithoutIceUfragPwd[]; | 68 extern const char kSdpWithoutIceUfragPwd[]; |
| 67 extern const char kSdpWithoutSdesAndDtlsDisabled[]; | 69 extern const char kSdpWithoutSdesAndDtlsDisabled[]; |
| 68 extern const char kSessionError[]; | 70 extern const char kSessionError[]; |
| 69 extern const char kSessionErrorDesc[]; | 71 extern const char kSessionErrorDesc[]; |
| 70 extern const char kDtlsSetupFailureRtp[]; | 72 extern const char kDtlsSrtpSetupFailureRtp[]; |
| 71 extern const char kDtlsSetupFailureRtcp[]; | 73 extern const char kDtlsSrtpSetupFailureRtcp[]; |
| 72 extern const char kEnableBundleFailed[]; | 74 extern const char kEnableBundleFailed[]; |
| 73 | 75 |
| 74 // Maximum number of received video streams that will be processed by webrtc | 76 // Maximum number of received video streams that will be processed by webrtc |
| 75 // even if they are not signalled beforehand. | 77 // even if they are not signalled beforehand. |
| 76 extern const int kMaxUnsignalledRecvStreams; | 78 extern const int kMaxUnsignalledRecvStreams; |
| 77 | 79 |
| 78 // ICE state callback interface. | 80 // ICE state callback interface. |
| 79 class IceObserver { | 81 class IceObserver { |
| 80 public: | 82 public: |
| 81 IceObserver() {} | 83 IceObserver() {} |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 STATE_INPROGRESS, // Offer/answer exchange completed. | 153 STATE_INPROGRESS, // Offer/answer exchange completed. |
| 152 STATE_CLOSED, // Close() was called. | 154 STATE_CLOSED, // Close() was called. |
| 153 }; | 155 }; |
| 154 | 156 |
| 155 enum Error { | 157 enum Error { |
| 156 ERROR_NONE = 0, // no error | 158 ERROR_NONE = 0, // no error |
| 157 ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent | 159 ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent |
| 158 ERROR_TRANSPORT = 2, // transport error of some kind | 160 ERROR_TRANSPORT = 2, // transport error of some kind |
| 159 }; | 161 }; |
| 160 | 162 |
| 163 // |sctp_factory| may be null, in which case SCTP is treated as unsupported. | |
| 161 WebRtcSession( | 164 WebRtcSession( |
| 162 webrtc::MediaControllerInterface* media_controller, | 165 webrtc::MediaControllerInterface* media_controller, |
| 163 rtc::Thread* network_thread, | 166 rtc::Thread* network_thread, |
| 164 rtc::Thread* worker_thread, | 167 rtc::Thread* worker_thread, |
| 165 rtc::Thread* signaling_thread, | 168 rtc::Thread* signaling_thread, |
| 166 cricket::PortAllocator* port_allocator, | 169 cricket::PortAllocator* port_allocator, |
| 167 std::unique_ptr<cricket::TransportController> transport_controller); | 170 std::unique_ptr<cricket::TransportController> transport_controller, |
| 171 std::unique_ptr<cricket::SctpTransportInternalFactory> sctp_factory); | |
| 168 virtual ~WebRtcSession(); | 172 virtual ~WebRtcSession(); |
| 169 | 173 |
| 170 // These are const to allow them to be called from const methods. | 174 // These are const to allow them to be called from const methods. |
| 171 rtc::Thread* network_thread() const { return network_thread_; } | 175 rtc::Thread* network_thread() const { return network_thread_; } |
| 172 rtc::Thread* worker_thread() const { return worker_thread_; } | 176 rtc::Thread* worker_thread() const { return worker_thread_; } |
| 173 rtc::Thread* signaling_thread() const { return signaling_thread_; } | 177 rtc::Thread* signaling_thread() const { return signaling_thread_; } |
| 174 | 178 |
| 175 // The ID of this session. | 179 // The ID of this session. |
| 176 const std::string& id() const { return sid_; } | 180 const std::string& id() const { return sid_; } |
| 177 | 181 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 192 sigslot::signal2<WebRtcSession*, State> SignalState; | 196 sigslot::signal2<WebRtcSession*, State> SignalState; |
| 193 | 197 |
| 194 // Returns the last error in the session. See the enum above for details. | 198 // Returns the last error in the session. See the enum above for details. |
| 195 Error error() const { return error_; } | 199 Error error() const { return error_; } |
| 196 const std::string& error_desc() const { return error_desc_; } | 200 const std::string& error_desc() const { return error_desc_; } |
| 197 | 201 |
| 198 void RegisterIceObserver(IceObserver* observer) { | 202 void RegisterIceObserver(IceObserver* observer) { |
| 199 ice_observer_ = observer; | 203 ice_observer_ = observer; |
| 200 } | 204 } |
| 201 | 205 |
| 206 // Exposed for stats collecting. | |
| 202 virtual cricket::VoiceChannel* voice_channel() { | 207 virtual cricket::VoiceChannel* voice_channel() { |
| 203 return voice_channel_.get(); | 208 return voice_channel_.get(); |
| 204 } | 209 } |
| 205 virtual cricket::VideoChannel* video_channel() { | 210 virtual cricket::VideoChannel* video_channel() { |
| 206 return video_channel_.get(); | 211 return video_channel_.get(); |
| 207 } | 212 } |
| 208 virtual cricket::DataChannel* data_channel() { | 213 // Only valid when using deprecated RTP data channels. |
| 209 return data_channel_.get(); | 214 virtual cricket::RtpDataChannel* rtp_data_channel() { |
| 215 return rtp_data_channel_.get(); | |
| 216 } | |
| 217 virtual std::string sctp_content_name() const { | |
| 218 return sctp_transport_ ? sctp_content_name_ : std::string(); | |
| 219 } | |
| 220 virtual std::string sctp_transport_name() const { | |
| 221 return sctp_transport_ ? sctp_transport_name_ : std::string(); | |
|
pthatcher1
2016/12/23 01:39:31
I think it would be slightly better to have these
Taylor Brandstetter
2016/12/23 06:29:05
Done.
| |
| 210 } | 222 } |
| 211 | 223 |
| 212 cricket::BaseChannel* GetChannel(const std::string& content_name); | 224 cricket::BaseChannel* GetChannel(const std::string& content_name); |
| 213 | 225 |
| 214 cricket::SecurePolicy SdesPolicy() const; | 226 cricket::SecurePolicy SdesPolicy() const; |
| 215 | 227 |
| 216 // Get current ssl role from transport. | 228 // Get current SSL role used by SCTP's underlying transport. |
| 217 bool GetSslRole(const std::string& transport_name, rtc::SSLRole* role); | 229 bool GetSctpSslRole(rtc::SSLRole* role); |
|
pthatcher1
2016/12/23 01:39:31
Why do we need this instead of just calling GetSsl
Taylor Brandstetter
2016/12/23 06:29:05
Because I want to remove GetSslRole (see below TOD
| |
| 218 | 230 // Get SSL role for an arbitrary m= section (handles bundling correctly). |
| 219 // Get current SSL role for this channel's transport. | 231 // TODO(deadbeef): This is only used internally by the session description |
| 220 // If |transport| is null, returns false. | 232 // factory, it shouldn't really be public). |
| 221 bool GetSslRole(const cricket::BaseChannel* channel, rtc::SSLRole* role); | 233 bool GetSslRole(const std::string& content_name, rtc::SSLRole* role); |
| 222 | 234 |
| 223 void CreateOffer( | 235 void CreateOffer( |
| 224 CreateSessionDescriptionObserver* observer, | 236 CreateSessionDescriptionObserver* observer, |
| 225 const PeerConnectionInterface::RTCOfferAnswerOptions& options, | 237 const PeerConnectionInterface::RTCOfferAnswerOptions& options, |
| 226 const cricket::MediaSessionOptions& session_options); | 238 const cricket::MediaSessionOptions& session_options); |
| 227 void CreateAnswer(CreateSessionDescriptionObserver* observer, | 239 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 228 const cricket::MediaSessionOptions& session_options); | 240 const cricket::MediaSessionOptions& session_options); |
| 229 // The ownership of |desc| will be transferred after this call. | 241 // The ownership of |desc| will be transferred after this call. |
| 230 bool SetLocalDescription(SessionDescriptionInterface* desc, | 242 bool SetLocalDescription(SessionDescriptionInterface* desc, |
| 231 std::string* err_desc); | 243 std::string* err_desc); |
| 232 // The ownership of |desc| will be transferred after this call. | 244 // The ownership of |desc| will be transferred after this call. |
| 233 bool SetRemoteDescription(SessionDescriptionInterface* desc, | 245 bool SetRemoteDescription(SessionDescriptionInterface* desc, |
| 234 std::string* err_desc); | 246 std::string* err_desc); |
| 247 | |
| 235 bool ProcessIceMessage(const IceCandidateInterface* ice_candidate); | 248 bool ProcessIceMessage(const IceCandidateInterface* ice_candidate); |
| 236 | 249 |
| 237 bool RemoveRemoteIceCandidates( | 250 bool RemoveRemoteIceCandidates( |
| 238 const std::vector<cricket::Candidate>& candidates); | 251 const std::vector<cricket::Candidate>& candidates); |
| 239 | 252 |
| 240 cricket::IceConfig ParseIceConfig( | 253 cricket::IceConfig ParseIceConfig( |
| 241 const PeerConnectionInterface::RTCConfiguration& config) const; | 254 const PeerConnectionInterface::RTCConfiguration& config) const; |
| 242 | 255 |
| 243 void SetIceConfig(const cricket::IceConfig& ice_config); | 256 void SetIceConfig(const cricket::IceConfig& ice_config); |
| 244 | 257 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 // Returns true if the ICE restart flag above was set, and no ICE restart has | 332 // Returns true if the ICE restart flag above was set, and no ICE restart has |
| 320 // occurred yet for this transport (by applying a local description with | 333 // occurred yet for this transport (by applying a local description with |
| 321 // changed ufrag/password). If the transport has been deleted as a result of | 334 // changed ufrag/password). If the transport has been deleted as a result of |
| 322 // bundling, returns false. | 335 // bundling, returns false. |
| 323 bool NeedsIceRestart(const std::string& content_name) const; | 336 bool NeedsIceRestart(const std::string& content_name) const; |
| 324 | 337 |
| 325 // Called when an RTCCertificate is generated or retrieved by | 338 // Called when an RTCCertificate is generated or retrieved by |
| 326 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. | 339 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. |
| 327 void OnCertificateReady( | 340 void OnCertificateReady( |
| 328 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | 341 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
| 329 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); | 342 void OnDtlsSrtpSetupFailure(cricket::BaseChannel*, bool rtcp); |
| 330 | 343 |
| 331 // For unit test. | 344 // For unit test. |
| 332 bool waiting_for_certificate_for_testing() const; | 345 bool waiting_for_certificate_for_testing() const; |
| 333 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); | 346 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); |
| 334 | 347 |
| 335 void set_metrics_observer( | 348 void set_metrics_observer( |
| 336 webrtc::MetricsObserverInterface* metrics_observer) { | 349 webrtc::MetricsObserverInterface* metrics_observer) { |
| 337 metrics_observer_ = metrics_observer; | 350 metrics_observer_ = metrics_observer; |
| 338 transport_controller_->SetMetricsObserver(metrics_observer); | 351 transport_controller_->SetMetricsObserver(metrics_observer); |
| 339 } | 352 } |
| 340 | 353 |
| 341 // Called when voice_channel_, video_channel_ and data_channel_ are created | 354 // Called when voice_channel_, video_channel_ and |
| 342 // and destroyed. As a result of, for example, setting a new description. | 355 // rtp_data_channel_/sctp_transport_ are created and destroyed. As a result |
| 356 // of, for example, setting a new description. | |
| 343 sigslot::signal0<> SignalVoiceChannelCreated; | 357 sigslot::signal0<> SignalVoiceChannelCreated; |
| 344 sigslot::signal0<> SignalVoiceChannelDestroyed; | 358 sigslot::signal0<> SignalVoiceChannelDestroyed; |
| 345 sigslot::signal0<> SignalVideoChannelCreated; | 359 sigslot::signal0<> SignalVideoChannelCreated; |
| 346 sigslot::signal0<> SignalVideoChannelDestroyed; | 360 sigslot::signal0<> SignalVideoChannelDestroyed; |
| 347 sigslot::signal0<> SignalDataChannelCreated; | 361 sigslot::signal0<> SignalDataChannelCreated; |
| 348 sigslot::signal0<> SignalDataChannelDestroyed; | 362 sigslot::signal0<> SignalDataChannelDestroyed; |
| 349 // Called when the whole session is destroyed. | 363 // Called when the whole session is destroyed. |
| 350 sigslot::signal0<> SignalDestroyed; | 364 sigslot::signal0<> SignalDestroyed; |
| 351 | 365 |
| 352 // Called when a valid data channel OPEN message is received. | 366 // Called when a valid data channel OPEN message is received. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 virtual void SetError(Error error, const std::string& error_desc); | 404 virtual void SetError(Error error, const std::string& error_desc); |
| 391 | 405 |
| 392 bool UpdateSessionState(Action action, cricket::ContentSource source, | 406 bool UpdateSessionState(Action action, cricket::ContentSource source, |
| 393 std::string* err_desc); | 407 std::string* err_desc); |
| 394 static Action GetAction(const std::string& type); | 408 static Action GetAction(const std::string& type); |
| 395 // Push the media parts of the local or remote session description | 409 // Push the media parts of the local or remote session description |
| 396 // down to all of the channels. | 410 // down to all of the channels. |
| 397 bool PushdownMediaDescription(cricket::ContentAction action, | 411 bool PushdownMediaDescription(cricket::ContentAction action, |
| 398 cricket::ContentSource source, | 412 cricket::ContentSource source, |
| 399 std::string* error_desc); | 413 std::string* error_desc); |
| 414 bool PushdownSctpParameters_n(cricket::ContentSource source); | |
| 400 | 415 |
| 401 bool PushdownTransportDescription(cricket::ContentSource source, | 416 bool PushdownTransportDescription(cricket::ContentSource source, |
| 402 cricket::ContentAction action, | 417 cricket::ContentAction action, |
| 403 std::string* error_desc); | 418 std::string* error_desc); |
| 404 | 419 |
| 405 // Helper methods to push local and remote transport descriptions. | 420 // Helper methods to push local and remote transport descriptions. |
| 406 bool PushdownLocalTransportDescription( | 421 bool PushdownLocalTransportDescription( |
| 407 const cricket::SessionDescription* sdesc, | 422 const cricket::SessionDescription* sdesc, |
| 408 cricket::ContentAction action, | 423 cricket::ContentAction action, |
| 409 std::string* error_desc); | 424 std::string* error_desc); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 bool CreateVoiceChannel(const cricket::ContentInfo* content, | 469 bool CreateVoiceChannel(const cricket::ContentInfo* content, |
| 455 const std::string* bundle_transport); | 470 const std::string* bundle_transport); |
| 456 bool CreateVideoChannel(const cricket::ContentInfo* content, | 471 bool CreateVideoChannel(const cricket::ContentInfo* content, |
| 457 const std::string* bundle_transport); | 472 const std::string* bundle_transport); |
| 458 bool CreateDataChannel(const cricket::ContentInfo* content, | 473 bool CreateDataChannel(const cricket::ContentInfo* content, |
| 459 const std::string* bundle_transport); | 474 const std::string* bundle_transport); |
| 460 | 475 |
| 461 std::unique_ptr<SessionStats> GetStats_n( | 476 std::unique_ptr<SessionStats> GetStats_n( |
| 462 const ChannelNamePairs& channel_name_pairs); | 477 const ChannelNamePairs& channel_name_pairs); |
| 463 | 478 |
| 464 // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN | 479 bool CreateSctpTransport_n(const std::string& content_name, |
| 465 // messages. | 480 const std::string& transport_name); |
| 466 void OnDataChannelMessageReceived(cricket::DataChannel* channel, | 481 // For bundling. |
| 467 const cricket::ReceiveDataParams& params, | 482 void ChangeSctpTransport_n(const std::string& transport_name); |
| 468 const rtc::CopyOnWriteBuffer& payload); | 483 void DestroySctpTransport_n(); |
| 484 // SctpTransport signal handlers. Needed to marshal signals from the network | |
| 485 // to signaling thread. | |
| 486 void OnSctpTransportReadyToSendData_n(); | |
| 487 // This may be called with "false" if the direction of the m= section causes | |
| 488 // us to tear down the SCTP connection. | |
| 489 void OnSctpTransportReadyToSendData_s(bool ready); | |
| 490 void OnSctpTransportDataReceived_n(const cricket::ReceiveDataParams& params, | |
| 491 const rtc::CopyOnWriteBuffer& payload); | |
| 492 // Beyond just firing the signal to the signaling thread, listens to SCTP | |
| 493 // CONTROL messages on unused SIDs and processes them as OPEN messages. | |
| 494 void OnSctpTransportDataReceived_s(const cricket::ReceiveDataParams& params, | |
| 495 const rtc::CopyOnWriteBuffer& payload); | |
| 496 void OnSctpStreamClosedRemotely_n(int sid); | |
| 469 | 497 |
| 470 std::string BadStateErrMsg(State state); | 498 std::string BadStateErrMsg(State state); |
| 471 void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); | 499 void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); |
| 472 void SetIceConnectionReceiving(bool receiving); | 500 void SetIceConnectionReceiving(bool receiving); |
| 473 | 501 |
| 474 bool ValidateBundleSettings(const cricket::SessionDescription* desc); | 502 bool ValidateBundleSettings(const cricket::SessionDescription* desc); |
| 475 bool HasRtcpMuxEnabled(const cricket::ContentInfo* content); | 503 bool HasRtcpMuxEnabled(const cricket::ContentInfo* content); |
| 476 // Below methods are helper methods which verifies SDP. | 504 // Below methods are helper methods which verifies SDP. |
| 477 bool ValidateSessionDescription(const SessionDescriptionInterface* sdesc, | 505 bool ValidateSessionDescription(const SessionDescriptionInterface* sdesc, |
| 478 cricket::ContentSource source, | 506 cricket::ContentSource source, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 491 // description should be used. Output |valid| is true if the candidate media | 519 // description should be used. Output |valid| is true if the candidate media |
| 492 // index is valid. | 520 // index is valid. |
| 493 bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate, | 521 bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate, |
| 494 const SessionDescriptionInterface* remote_desc, | 522 const SessionDescriptionInterface* remote_desc, |
| 495 bool* valid); | 523 bool* valid); |
| 496 | 524 |
| 497 // Returns true if SRTP (either using DTLS-SRTP or SDES) is required by | 525 // Returns true if SRTP (either using DTLS-SRTP or SDES) is required by |
| 498 // this session. | 526 // this session. |
| 499 bool SrtpRequired() const; | 527 bool SrtpRequired() const; |
| 500 | 528 |
| 529 // TransportController signal handlers. | |
| 501 void OnTransportControllerConnectionState(cricket::IceConnectionState state); | 530 void OnTransportControllerConnectionState(cricket::IceConnectionState state); |
| 502 void OnTransportControllerReceiving(bool receiving); | 531 void OnTransportControllerReceiving(bool receiving); |
| 503 void OnTransportControllerGatheringState(cricket::IceGatheringState state); | 532 void OnTransportControllerGatheringState(cricket::IceGatheringState state); |
| 504 void OnTransportControllerCandidatesGathered( | 533 void OnTransportControllerCandidatesGathered( |
| 505 const std::string& transport_name, | 534 const std::string& transport_name, |
| 506 const std::vector<cricket::Candidate>& candidates); | 535 const std::vector<cricket::Candidate>& candidates); |
| 507 void OnTransportControllerCandidatesRemoved( | 536 void OnTransportControllerCandidatesRemoved( |
| 508 const std::vector<cricket::Candidate>& candidates); | 537 const std::vector<cricket::Candidate>& candidates); |
| 538 void OnTransportControllerDtlsHandshakeError(rtc::SSLHandshakeError error); | |
| 509 | 539 |
| 510 std::string GetSessionErrorMsg(); | 540 std::string GetSessionErrorMsg(); |
| 511 | 541 |
| 512 // Invoked when TransportController connection completion is signaled. | 542 // Invoked when TransportController connection completion is signaled. |
| 513 // Reports stats for all transports in use. | 543 // Reports stats for all transports in use. |
| 514 void ReportTransportStats(); | 544 void ReportTransportStats(); |
| 515 | 545 |
| 516 // Gather the usage of IPv4/IPv6 as best connection. | 546 // Gather the usage of IPv4/IPv6 as best connection. |
| 517 void ReportBestConnectionState(const cricket::TransportStats& stats); | 547 void ReportBestConnectionState(const cricket::TransportStats& stats); |
| 518 | 548 |
| 519 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); | 549 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); |
| 520 | 550 |
| 521 void OnSentPacket_w(const rtc::SentPacket& sent_packet); | 551 void OnSentPacket_w(const rtc::SentPacket& sent_packet); |
| 522 | 552 |
| 523 const std::string GetTransportName(const std::string& content_name); | 553 const std::string GetTransportName(const std::string& content_name); |
| 524 | 554 |
| 525 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); | |
| 526 | |
| 527 rtc::Thread* const network_thread_; | 555 rtc::Thread* const network_thread_; |
| 528 rtc::Thread* const worker_thread_; | 556 rtc::Thread* const worker_thread_; |
| 529 rtc::Thread* const signaling_thread_; | 557 rtc::Thread* const signaling_thread_; |
| 530 | 558 |
| 531 State state_ = STATE_INIT; | 559 State state_ = STATE_INIT; |
| 532 Error error_ = ERROR_NONE; | 560 Error error_ = ERROR_NONE; |
| 533 std::string error_desc_; | 561 std::string error_desc_; |
| 534 | 562 |
| 535 const std::string sid_; | 563 const std::string sid_; |
| 536 bool initial_offerer_ = false; | 564 bool initial_offerer_ = false; |
| 537 | 565 |
| 538 const std::unique_ptr<cricket::TransportController> transport_controller_; | 566 const std::unique_ptr<cricket::TransportController> transport_controller_; |
| 567 const std::unique_ptr<cricket::SctpTransportInternalFactory> sctp_factory_; | |
| 539 MediaControllerInterface* media_controller_; | 568 MediaControllerInterface* media_controller_; |
| 540 std::unique_ptr<cricket::VoiceChannel> voice_channel_; | 569 std::unique_ptr<cricket::VoiceChannel> voice_channel_; |
| 541 std::unique_ptr<cricket::VideoChannel> video_channel_; | 570 std::unique_ptr<cricket::VideoChannel> video_channel_; |
| 542 std::unique_ptr<cricket::DataChannel> data_channel_; | 571 // |rtp_data_channel_| is used if in RTP data channel mode, |sctp_transport_| |
| 572 // when using SCTP. | |
| 573 std::unique_ptr<cricket::RtpDataChannel> rtp_data_channel_; | |
| 574 | |
| 575 std::unique_ptr<cricket::SctpTransportInternal> sctp_transport_; | |
| 576 // |sctp_transport_name_| keeps track of what DTLS transport the SCTP | |
| 577 // transport is using (which can change due to bundling). | |
| 578 std::string sctp_transport_name_; | |
| 579 // |sctp_content_name_| is the content name (MID) in SDP. | |
| 580 std::string sctp_content_name_; | |
| 581 // Value cached on signaling thread. Only updated when SctpReadyToSendData | |
| 582 // fires on the signaling thread. | |
| 583 bool sctp_ready_to_send_data_ = false; | |
| 584 // Same as signals provided by SctpTransport, but these are guaranteed to | |
| 585 // fire on the signaling thread, whereas SctpTransport fires on the networking | |
| 586 // thread. | |
|
pthatcher1
2016/12/23 01:39:31
Why don't we just pass a thread to the SctpTranspo
Taylor Brandstetter
2016/12/23 06:29:05
Because that's giving SctpTransport more responsib
| |
| 587 // |sctp_invoker_| is used so that any signals queued on the signaling thread | |
| 588 // from the network thread are immediately discarded if the SctpTransport is | |
| 589 // destroyed (due to m= section being rejected). | |
| 590 std::unique_ptr<rtc::AsyncInvoker> sctp_invoker_; | |
| 591 sigslot::signal1<bool> SignalSctpReadyToSendData; | |
| 592 sigslot::signal2<const cricket::ReceiveDataParams&, | |
| 593 const rtc::CopyOnWriteBuffer&> | |
| 594 SignalSctpDataReceived; | |
| 595 sigslot::signal1<int> SignalSctpStreamClosedRemotely; | |
| 596 | |
| 543 cricket::ChannelManager* channel_manager_; | 597 cricket::ChannelManager* channel_manager_; |
| 544 IceObserver* ice_observer_; | 598 IceObserver* ice_observer_; |
| 545 PeerConnectionInterface::IceConnectionState ice_connection_state_; | 599 PeerConnectionInterface::IceConnectionState ice_connection_state_; |
| 546 bool ice_connection_receiving_; | 600 bool ice_connection_receiving_; |
| 547 std::unique_ptr<SessionDescriptionInterface> current_local_description_; | 601 std::unique_ptr<SessionDescriptionInterface> current_local_description_; |
| 548 std::unique_ptr<SessionDescriptionInterface> pending_local_description_; | 602 std::unique_ptr<SessionDescriptionInterface> pending_local_description_; |
| 549 std::unique_ptr<SessionDescriptionInterface> current_remote_description_; | 603 std::unique_ptr<SessionDescriptionInterface> current_remote_description_; |
| 550 std::unique_ptr<SessionDescriptionInterface> pending_remote_description_; | 604 std::unique_ptr<SessionDescriptionInterface> pending_remote_description_; |
| 551 // If the remote peer is using a older version of implementation. | 605 // If the remote peer is using a older version of implementation. |
| 552 bool older_version_remote_peer_; | 606 bool older_version_remote_peer_; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 582 | 636 |
| 583 #ifdef HAVE_QUIC | 637 #ifdef HAVE_QUIC |
| 584 std::unique_ptr<QuicDataTransport> quic_data_transport_; | 638 std::unique_ptr<QuicDataTransport> quic_data_transport_; |
| 585 #endif // HAVE_QUIC | 639 #endif // HAVE_QUIC |
| 586 | 640 |
| 587 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 641 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
| 588 }; | 642 }; |
| 589 } // namespace webrtc | 643 } // namespace webrtc |
| 590 | 644 |
| 591 #endif // WEBRTC_API_WEBRTCSESSION_H_ | 645 #endif // WEBRTC_API_WEBRTCSESSION_H_ |
| OLD | NEW |