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 13 matching lines...) Expand all Loading... |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_ | 28 #ifndef TALK_APP_WEBRTC_WEBRTCSESSION_H_ |
29 #define TALK_APP_WEBRTC_WEBRTCSESSION_H_ | 29 #define TALK_APP_WEBRTC_WEBRTCSESSION_H_ |
30 | 30 |
31 #include <string> | 31 #include <string> |
32 | 32 |
33 #include "talk/app/webrtc/datachannel.h" | 33 #include "talk/app/webrtc/datachannel.h" |
| 34 #include "talk/app/webrtc/dtlscertificate.h" |
34 #include "talk/app/webrtc/dtmfsender.h" | 35 #include "talk/app/webrtc/dtmfsender.h" |
35 #include "talk/app/webrtc/mediastreamprovider.h" | 36 #include "talk/app/webrtc/mediastreamprovider.h" |
36 #include "talk/app/webrtc/peerconnectioninterface.h" | 37 #include "talk/app/webrtc/peerconnectioninterface.h" |
37 #include "talk/app/webrtc/statstypes.h" | 38 #include "talk/app/webrtc/statstypes.h" |
38 #include "talk/media/base/mediachannel.h" | 39 #include "talk/media/base/mediachannel.h" |
39 #include "webrtc/p2p/base/session.h" | 40 #include "webrtc/p2p/base/session.h" |
40 #include "talk/session/media/mediasession.h" | 41 #include "talk/session/media/mediasession.h" |
41 #include "webrtc/base/sigslot.h" | 42 #include "webrtc/base/sigslot.h" |
42 #include "webrtc/base/thread.h" | 43 #include "webrtc/base/thread.h" |
43 | 44 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 WebRtcSession(cricket::ChannelManager* channel_manager, | 119 WebRtcSession(cricket::ChannelManager* channel_manager, |
119 rtc::Thread* signaling_thread, | 120 rtc::Thread* signaling_thread, |
120 rtc::Thread* worker_thread, | 121 rtc::Thread* worker_thread, |
121 cricket::PortAllocator* port_allocator, | 122 cricket::PortAllocator* port_allocator, |
122 MediaStreamSignaling* mediastream_signaling); | 123 MediaStreamSignaling* mediastream_signaling); |
123 virtual ~WebRtcSession(); | 124 virtual ~WebRtcSession(); |
124 | 125 |
125 bool Initialize( | 126 bool Initialize( |
126 const PeerConnectionFactoryInterface::Options& options, | 127 const PeerConnectionFactoryInterface::Options& options, |
127 const MediaConstraintsInterface* constraints, | 128 const MediaConstraintsInterface* constraints, |
128 DTLSIdentityServiceInterface* dtls_identity_service, | 129 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate, |
129 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); | 130 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); |
130 // Deletes the voice, video and data channel and changes the session state | 131 // Deletes the voice, video and data channel and changes the session state |
131 // to STATE_RECEIVEDTERMINATE. | 132 // to STATE_RECEIVEDTERMINATE. |
132 void Terminate(); | 133 void Terminate(); |
133 | 134 |
134 void RegisterIceObserver(IceObserver* observer) { | 135 void RegisterIceObserver(IceObserver* observer) { |
135 ice_observer_ = observer; | 136 ice_observer_ = observer; |
136 } | 137 } |
137 | 138 |
138 virtual cricket::VoiceChannel* voice_channel() { | 139 virtual cricket::VoiceChannel* voice_channel() { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 rtc::scoped_refptr<DataChannel> CreateDataChannel( | 239 rtc::scoped_refptr<DataChannel> CreateDataChannel( |
239 const std::string& label, | 240 const std::string& label, |
240 const InternalDataChannelInit* config) override; | 241 const InternalDataChannelInit* config) override; |
241 | 242 |
242 cricket::DataChannelType data_channel_type() const; | 243 cricket::DataChannelType data_channel_type() const; |
243 | 244 |
244 bool IceRestartPending() const; | 245 bool IceRestartPending() const; |
245 | 246 |
246 void ResetIceRestartLatch(); | 247 void ResetIceRestartLatch(); |
247 | 248 |
248 // Called when an SSLIdentity is generated or retrieved by | 249 // Called when a DtlsCertificate is generated or retrieved by |
249 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. | 250 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. |
250 void OnIdentityReady(rtc::SSLIdentity* identity); | 251 void OnCertificateReady(rtc::scoped_refptr<DtlsCertificate> certificate); |
251 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); | 252 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); |
252 | 253 |
253 // For unit test. | 254 // For unit test. |
254 bool waiting_for_identity() const; | 255 bool waiting_for_certificate() const; |
255 | 256 |
256 void set_metrics_observer( | 257 void set_metrics_observer( |
257 webrtc::MetricsObserverInterface* metrics_observer) { | 258 webrtc::MetricsObserverInterface* metrics_observer) { |
258 metrics_observer_ = metrics_observer; | 259 metrics_observer_ = metrics_observer; |
259 } | 260 } |
260 | 261 |
261 private: | 262 private: |
262 // Indicates the type of SessionDescription in a call to SetLocalDescription | 263 // Indicates the type of SessionDescription in a call to SetLocalDescription |
263 // and SetRemoteDescription. | 264 // and SetRemoteDescription. |
264 enum Action { | 265 enum Action { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 bool dtls_enabled_; | 386 bool dtls_enabled_; |
386 // Specifies which kind of data channel is allowed. This is controlled | 387 // Specifies which kind of data channel is allowed. This is controlled |
387 // by the chrome command-line flag and constraints: | 388 // by the chrome command-line flag and constraints: |
388 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, | 389 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, |
389 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is | 390 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is |
390 // not set or false, SCTP is allowed (DCT_SCTP); | 391 // not set or false, SCTP is allowed (DCT_SCTP); |
391 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); | 392 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); |
392 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). | 393 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). |
393 cricket::DataChannelType data_channel_type_; | 394 cricket::DataChannelType data_channel_type_; |
394 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; | 395 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; |
| 396 rtc::scoped_refptr<DtlsCertificate> certificate_; |
395 | 397 |
396 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> | 398 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> |
397 webrtc_session_desc_factory_; | 399 webrtc_session_desc_factory_; |
398 | 400 |
399 sigslot::signal0<> SignalVoiceChannelDestroyed; | 401 sigslot::signal0<> SignalVoiceChannelDestroyed; |
400 sigslot::signal0<> SignalVideoChannelDestroyed; | 402 sigslot::signal0<> SignalVideoChannelDestroyed; |
401 sigslot::signal0<> SignalDataChannelDestroyed; | 403 sigslot::signal0<> SignalDataChannelDestroyed; |
402 | 404 |
403 // Member variables for caching global options. | 405 // Member variables for caching global options. |
404 cricket::AudioOptions audio_options_; | 406 cricket::AudioOptions audio_options_; |
405 cricket::VideoOptions video_options_; | 407 cricket::VideoOptions video_options_; |
406 MetricsObserverInterface* metrics_observer_; | 408 MetricsObserverInterface* metrics_observer_; |
407 | 409 |
408 // Declares the bundle policy for the WebRTCSession. | 410 // Declares the bundle policy for the WebRTCSession. |
409 PeerConnectionInterface::BundlePolicy bundle_policy_; | 411 PeerConnectionInterface::BundlePolicy bundle_policy_; |
410 | 412 |
411 // Declares the RTCP mux policy for the WebRTCSession. | 413 // Declares the RTCP mux policy for the WebRTCSession. |
412 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; | 414 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; |
413 | 415 |
414 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 416 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
415 }; | 417 }; |
416 } // namespace webrtc | 418 } // namespace webrtc |
417 | 419 |
418 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ | 420 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ |
OLD | NEW |