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