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/sslidentity.h" | 43 #include "webrtc/base/sslidentity.h" |
43 #include "webrtc/base/thread.h" | 44 #include "webrtc/base/thread.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 public DtmfProviderInterface, | 117 public DtmfProviderInterface, |
117 public DataChannelProviderInterface { | 118 public DataChannelProviderInterface { |
118 public: | 119 public: |
119 WebRtcSession(cricket::ChannelManager* channel_manager, | 120 WebRtcSession(cricket::ChannelManager* channel_manager, |
120 rtc::Thread* signaling_thread, | 121 rtc::Thread* signaling_thread, |
121 rtc::Thread* worker_thread, | 122 rtc::Thread* worker_thread, |
122 cricket::PortAllocator* port_allocator, | 123 cricket::PortAllocator* port_allocator, |
123 MediaStreamSignaling* mediastream_signaling); | 124 MediaStreamSignaling* mediastream_signaling); |
124 virtual ~WebRtcSession(); | 125 virtual ~WebRtcSession(); |
125 | 126 |
127 // This method takes the ownership of |dtls_identity_service|. | |
126 bool Initialize( | 128 bool Initialize( |
127 const PeerConnectionFactoryInterface::Options& options, | 129 const PeerConnectionFactoryInterface::Options& options, |
128 const MediaConstraintsInterface* constraints, | 130 const MediaConstraintsInterface* constraints, |
129 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 131 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
130 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); | 132 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); |
133 bool Initialize( | |
134 const PeerConnectionFactoryInterface::Options& options, | |
135 const MediaConstraintsInterface* constraints, | |
136 const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate, | |
137 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); | |
131 // Deletes the voice, video and data channel and changes the session state | 138 // Deletes the voice, video and data channel and changes the session state |
132 // to STATE_RECEIVEDTERMINATE. | 139 // to STATE_RECEIVEDTERMINATE. |
133 void Terminate(); | 140 void Terminate(); |
134 | 141 |
135 void RegisterIceObserver(IceObserver* observer) { | 142 void RegisterIceObserver(IceObserver* observer) { |
136 ice_observer_ = observer; | 143 ice_observer_ = observer; |
137 } | 144 } |
138 | 145 |
139 virtual cricket::VoiceChannel* voice_channel() { | 146 virtual cricket::VoiceChannel* voice_channel() { |
140 return voice_channel_.get(); | 147 return voice_channel_.get(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 rtc::scoped_refptr<DataChannel> CreateDataChannel( | 246 rtc::scoped_refptr<DataChannel> CreateDataChannel( |
240 const std::string& label, | 247 const std::string& label, |
241 const InternalDataChannelInit* config) override; | 248 const InternalDataChannelInit* config) override; |
242 | 249 |
243 cricket::DataChannelType data_channel_type() const; | 250 cricket::DataChannelType data_channel_type() const; |
244 | 251 |
245 bool IceRestartPending() const; | 252 bool IceRestartPending() const; |
246 | 253 |
247 void ResetIceRestartLatch(); | 254 void ResetIceRestartLatch(); |
248 | 255 |
249 // Called when an SSLIdentity is generated or retrieved by | 256 // Called when a DtlsCertificate is generated or retrieved by |
250 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. | 257 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. |
251 void OnIdentityReady(rtc::SSLIdentity* identity); | 258 void OnCertificateReady( |
259 const rtc::scoped_refptr<DtlsCertificate>& certificate); | |
252 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); | 260 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); |
253 | 261 |
254 // For unit test. | 262 // For unit test. |
255 bool waiting_for_identity() const; | 263 bool waiting_for_certificate() const; |
264 rtc::scoped_refptr<DtlsCertificate> get_certificate() const; | |
256 | 265 |
257 void set_metrics_observer( | 266 void set_metrics_observer( |
258 webrtc::MetricsObserverInterface* metrics_observer) { | 267 webrtc::MetricsObserverInterface* metrics_observer) { |
259 metrics_observer_ = metrics_observer; | 268 metrics_observer_ = metrics_observer; |
260 } | 269 } |
261 | 270 |
262 private: | 271 private: |
263 // Indicates the type of SessionDescription in a call to SetLocalDescription | 272 // Indicates the type of SessionDescription in a call to SetLocalDescription |
264 // and SetRemoteDescription. | 273 // and SetRemoteDescription. |
265 enum Action { | 274 enum Action { |
266 kOffer, | 275 kOffer, |
267 kPrAnswer, | 276 kPrAnswer, |
268 kAnswer, | 277 kAnswer, |
269 }; | 278 }; |
270 | 279 |
280 bool InitializeCommon( | |
Henrik Grunell WebRTC
2015/08/12 14:46:30
Same here as other files, improve naming.
hbos
2015/08/14 14:09:39
Done.
| |
281 const PeerConnectionFactoryInterface::Options& options, | |
282 const MediaConstraintsInterface* constraints, | |
283 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); | |
284 void InitializeFactoryAfterConstruction( | |
285 const PeerConnectionFactoryInterface::Options& options); | |
286 | |
271 // Invokes ConnectChannels() on transport proxies, which initiates ice | 287 // Invokes ConnectChannels() on transport proxies, which initiates ice |
272 // candidates allocation. | 288 // candidates allocation. |
273 bool StartCandidatesAllocation(); | 289 bool StartCandidatesAllocation(); |
274 bool UpdateSessionState(Action action, cricket::ContentSource source, | 290 bool UpdateSessionState(Action action, cricket::ContentSource source, |
275 std::string* err_desc); | 291 std::string* err_desc); |
276 static Action GetAction(const std::string& type); | 292 static Action GetAction(const std::string& type); |
277 // Push the media parts of the local or remote session description | 293 // Push the media parts of the local or remote session description |
278 // down to all of the channels. | 294 // down to all of the channels. |
279 bool PushdownMediaDescription(cricket::ContentAction action, | 295 bool PushdownMediaDescription(cricket::ContentAction action, |
280 cricket::ContentSource source, | 296 cricket::ContentSource source, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 bool dtls_enabled_; | 402 bool dtls_enabled_; |
387 // Specifies which kind of data channel is allowed. This is controlled | 403 // Specifies which kind of data channel is allowed. This is controlled |
388 // by the chrome command-line flag and constraints: | 404 // by the chrome command-line flag and constraints: |
389 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, | 405 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, |
390 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is | 406 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is |
391 // not set or false, SCTP is allowed (DCT_SCTP); | 407 // not set or false, SCTP is allowed (DCT_SCTP); |
392 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); | 408 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); |
393 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). | 409 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). |
394 cricket::DataChannelType data_channel_type_; | 410 cricket::DataChannelType data_channel_type_; |
395 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; | 411 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; |
412 rtc::scoped_refptr<DtlsCertificate> certificate_; | |
396 | 413 |
397 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> | 414 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> |
398 webrtc_session_desc_factory_; | 415 webrtc_session_desc_factory_; |
399 | 416 |
400 sigslot::signal0<> SignalVoiceChannelDestroyed; | 417 sigslot::signal0<> SignalVoiceChannelDestroyed; |
401 sigslot::signal0<> SignalVideoChannelDestroyed; | 418 sigslot::signal0<> SignalVideoChannelDestroyed; |
402 sigslot::signal0<> SignalDataChannelDestroyed; | 419 sigslot::signal0<> SignalDataChannelDestroyed; |
403 | 420 |
404 // Member variables for caching global options. | 421 // Member variables for caching global options. |
405 cricket::AudioOptions audio_options_; | 422 cricket::AudioOptions audio_options_; |
406 cricket::VideoOptions video_options_; | 423 cricket::VideoOptions video_options_; |
407 MetricsObserverInterface* metrics_observer_; | 424 MetricsObserverInterface* metrics_observer_; |
408 | 425 |
409 // Declares the bundle policy for the WebRTCSession. | 426 // Declares the bundle policy for the WebRTCSession. |
410 PeerConnectionInterface::BundlePolicy bundle_policy_; | 427 PeerConnectionInterface::BundlePolicy bundle_policy_; |
411 | 428 |
412 // Declares the RTCP mux policy for the WebRTCSession. | 429 // Declares the RTCP mux policy for the WebRTCSession. |
413 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; | 430 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; |
414 | 431 |
415 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 432 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
416 }; | 433 }; |
417 } // namespace webrtc | 434 } // namespace webrtc |
418 | 435 |
419 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ | 436 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ |
OLD | NEW |