OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 extern const char kDtlsSetupFailureRtcp[]; | 77 extern const char kDtlsSetupFailureRtcp[]; |
78 // Maximum number of received video streams that will be processed by webrtc | 78 // Maximum number of received video streams that will be processed by webrtc |
79 // even if they are not signalled beforehand. | 79 // even if they are not signalled beforehand. |
80 extern const int kMaxUnsignalledRecvStreams; | 80 extern const int kMaxUnsignalledRecvStreams; |
81 | 81 |
82 // ICE state callback interface. | 82 // ICE state callback interface. |
83 class IceObserver { | 83 class IceObserver { |
84 public: | 84 public: |
85 IceObserver() {} | 85 IceObserver() {} |
86 // Called any time the IceConnectionState changes | 86 // Called any time the IceConnectionState changes |
| 87 // TODO(honghaiz): Change the name to OnIceConnectionStateChange so as to |
| 88 // conform to the w3c standard. |
87 virtual void OnIceConnectionChange( | 89 virtual void OnIceConnectionChange( |
88 PeerConnectionInterface::IceConnectionState new_state) {} | 90 PeerConnectionInterface::IceConnectionState new_state) {} |
89 // Called any time the IceGatheringState changes | 91 // Called any time the IceGatheringState changes |
90 virtual void OnIceGatheringChange( | 92 virtual void OnIceGatheringChange( |
91 PeerConnectionInterface::IceGatheringState new_state) {} | 93 PeerConnectionInterface::IceGatheringState new_state) {} |
92 // New Ice candidate have been found. | 94 // New Ice candidate have been found. |
93 virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; | 95 virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; |
94 // All Ice candidates have been found. | 96 // All Ice candidates have been found. |
95 // TODO(bemasc): Remove this once callers transition to OnIceGatheringChange. | 97 // TODO(bemasc): Remove this once callers transition to OnIceGatheringChange. |
96 // (via PeerConnectionObserver) | 98 // (via PeerConnectionObserver) |
97 virtual void OnIceComplete() {} | 99 virtual void OnIceComplete() {} |
98 | 100 |
| 101 // Called whenever the state changes between receiving and not receiving. |
| 102 virtual void OnIceConnectionReceivingChange(bool receiving) {} |
| 103 |
99 protected: | 104 protected: |
100 ~IceObserver() {} | 105 ~IceObserver() {} |
101 | 106 |
102 private: | 107 private: |
103 DISALLOW_COPY_AND_ASSIGN(IceObserver); | 108 DISALLOW_COPY_AND_ASSIGN(IceObserver); |
104 }; | 109 }; |
105 | 110 |
106 class WebRtcSession : public cricket::BaseSession, | 111 class WebRtcSession : public cricket::BaseSession, |
107 public AudioProviderInterface, | 112 public AudioProviderInterface, |
108 public DataChannelFactory, | 113 public DataChannelFactory, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Transport related callbacks, override from cricket::BaseSession. | 296 // Transport related callbacks, override from cricket::BaseSession. |
292 virtual void OnTransportRequestSignaling(cricket::Transport* transport); | 297 virtual void OnTransportRequestSignaling(cricket::Transport* transport); |
293 virtual void OnTransportConnecting(cricket::Transport* transport); | 298 virtual void OnTransportConnecting(cricket::Transport* transport); |
294 virtual void OnTransportWritable(cricket::Transport* transport); | 299 virtual void OnTransportWritable(cricket::Transport* transport); |
295 virtual void OnTransportCompleted(cricket::Transport* transport); | 300 virtual void OnTransportCompleted(cricket::Transport* transport); |
296 virtual void OnTransportFailed(cricket::Transport* transport); | 301 virtual void OnTransportFailed(cricket::Transport* transport); |
297 virtual void OnTransportProxyCandidatesReady( | 302 virtual void OnTransportProxyCandidatesReady( |
298 cricket::TransportProxy* proxy, | 303 cricket::TransportProxy* proxy, |
299 const cricket::Candidates& candidates); | 304 const cricket::Candidates& candidates); |
300 virtual void OnCandidatesAllocationDone(); | 305 virtual void OnCandidatesAllocationDone(); |
| 306 void OnTransportReceiving(cricket::Transport* transport) override; |
301 | 307 |
302 // Enables media channels to allow sending of media. | 308 // Enables media channels to allow sending of media. |
303 void EnableChannels(); | 309 void EnableChannels(); |
304 // Creates a JsepIceCandidate and adds it to the local session description | 310 // Creates a JsepIceCandidate and adds it to the local session description |
305 // and notify observers. Called when a new local candidate have been found. | 311 // and notify observers. Called when a new local candidate have been found. |
306 void ProcessNewLocalCandidate(const std::string& content_name, | 312 void ProcessNewLocalCandidate(const std::string& content_name, |
307 const cricket::Candidates& candidates); | 313 const cricket::Candidates& candidates); |
308 // Returns the media index for a local ice candidate given the content name. | 314 // Returns the media index for a local ice candidate given the content name. |
309 // Returns false if the local session description does not have a media | 315 // Returns false if the local session description does not have a media |
310 // content called |content_name|. | 316 // content called |content_name|. |
(...skipping 24 matching lines...) Expand all Loading... |
335 void CopySavedCandidates(SessionDescriptionInterface* dest_desc); | 341 void CopySavedCandidates(SessionDescriptionInterface* dest_desc); |
336 | 342 |
337 // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN | 343 // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN |
338 // messages. | 344 // messages. |
339 void OnDataChannelMessageReceived(cricket::DataChannel* channel, | 345 void OnDataChannelMessageReceived(cricket::DataChannel* channel, |
340 const cricket::ReceiveDataParams& params, | 346 const cricket::ReceiveDataParams& params, |
341 const rtc::Buffer& payload); | 347 const rtc::Buffer& payload); |
342 | 348 |
343 std::string BadStateErrMsg(State state); | 349 std::string BadStateErrMsg(State state); |
344 void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); | 350 void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); |
| 351 void SetIceConnectionReceiving(bool receiving); |
345 | 352 |
346 bool ValidateBundleSettings(const cricket::SessionDescription* desc); | 353 bool ValidateBundleSettings(const cricket::SessionDescription* desc); |
347 bool HasRtcpMuxEnabled(const cricket::ContentInfo* content); | 354 bool HasRtcpMuxEnabled(const cricket::ContentInfo* content); |
348 // Below methods are helper methods which verifies SDP. | 355 // Below methods are helper methods which verifies SDP. |
349 bool ValidateSessionDescription(const SessionDescriptionInterface* sdesc, | 356 bool ValidateSessionDescription(const SessionDescriptionInterface* sdesc, |
350 cricket::ContentSource source, | 357 cricket::ContentSource source, |
351 std::string* err_desc); | 358 std::string* err_desc); |
352 | 359 |
353 // Check if a call to SetLocalDescription is acceptable with |action|. | 360 // Check if a call to SetLocalDescription is acceptable with |action|. |
354 bool ExpectSetLocalDescription(Action action); | 361 bool ExpectSetLocalDescription(Action action); |
(...skipping 19 matching lines...) Expand all Loading... |
374 | 381 |
375 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); | 382 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); |
376 | 383 |
377 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_; | 384 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_; |
378 rtc::scoped_ptr<cricket::VideoChannel> video_channel_; | 385 rtc::scoped_ptr<cricket::VideoChannel> video_channel_; |
379 rtc::scoped_ptr<cricket::DataChannel> data_channel_; | 386 rtc::scoped_ptr<cricket::DataChannel> data_channel_; |
380 cricket::ChannelManager* channel_manager_; | 387 cricket::ChannelManager* channel_manager_; |
381 MediaStreamSignaling* mediastream_signaling_; | 388 MediaStreamSignaling* mediastream_signaling_; |
382 IceObserver* ice_observer_; | 389 IceObserver* ice_observer_; |
383 PeerConnectionInterface::IceConnectionState ice_connection_state_; | 390 PeerConnectionInterface::IceConnectionState ice_connection_state_; |
| 391 bool ice_connection_receiving_; |
384 rtc::scoped_ptr<SessionDescriptionInterface> local_desc_; | 392 rtc::scoped_ptr<SessionDescriptionInterface> local_desc_; |
385 rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_; | 393 rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_; |
386 // Candidates that arrived before the remote description was set. | 394 // Candidates that arrived before the remote description was set. |
387 std::vector<IceCandidateInterface*> saved_candidates_; | 395 std::vector<IceCandidateInterface*> saved_candidates_; |
388 // If the remote peer is using a older version of implementation. | 396 // If the remote peer is using a older version of implementation. |
389 bool older_version_remote_peer_; | 397 bool older_version_remote_peer_; |
390 bool dtls_enabled_; | 398 bool dtls_enabled_; |
391 // Specifies which kind of data channel is allowed. This is controlled | 399 // Specifies which kind of data channel is allowed. This is controlled |
392 // by the chrome command-line flag and constraints: | 400 // by the chrome command-line flag and constraints: |
393 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, | 401 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, |
(...skipping 20 matching lines...) Expand all Loading... |
414 PeerConnectionInterface::BundlePolicy bundle_policy_; | 422 PeerConnectionInterface::BundlePolicy bundle_policy_; |
415 | 423 |
416 // Declares the RTCP mux policy for the WebRTCSession. | 424 // Declares the RTCP mux policy for the WebRTCSession. |
417 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; | 425 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; |
418 | 426 |
419 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 427 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
420 }; | 428 }; |
421 } // namespace webrtc | 429 } // namespace webrtc |
422 | 430 |
423 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ | 431 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ |
OLD | NEW |