Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: talk/app/webrtc/webrtcsession.h

Issue 1269843005: Added DtlsCertificate, a ref counted object owning an SSLIdentity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Cleanup Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 public DtmfProviderInterface, 116 public DtmfProviderInterface,
116 public DataChannelProviderInterface { 117 public DataChannelProviderInterface {
117 public: 118 public:
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
126 // This method takes the ownership of |dtls_identity_service|.
125 bool Initialize( 127 bool Initialize(
126 const PeerConnectionFactoryInterface::Options& options, 128 const PeerConnectionFactoryInterface::Options& options,
127 const MediaConstraintsInterface* constraints, 129 const MediaConstraintsInterface* constraints,
128 DTLSIdentityServiceInterface* dtls_identity_service, 130 DTLSIdentityServiceInterface* dtls_identity_service,
129 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); 131 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
132 bool Initialize(
133 const PeerConnectionFactoryInterface::Options& options,
134 const MediaConstraintsInterface* constraints,
135 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate,
136 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
130 // Deletes the voice, video and data channel and changes the session state 137 // Deletes the voice, video and data channel and changes the session state
131 // to STATE_RECEIVEDTERMINATE. 138 // to STATE_RECEIVEDTERMINATE.
132 void Terminate(); 139 void Terminate();
133 140
134 void RegisterIceObserver(IceObserver* observer) { 141 void RegisterIceObserver(IceObserver* observer) {
135 ice_observer_ = observer; 142 ice_observer_ = observer;
136 } 143 }
137 144
138 virtual cricket::VoiceChannel* voice_channel() { 145 virtual cricket::VoiceChannel* voice_channel() {
139 return voice_channel_.get(); 146 return voice_channel_.get();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 rtc::scoped_refptr<DataChannel> CreateDataChannel( 245 rtc::scoped_refptr<DataChannel> CreateDataChannel(
239 const std::string& label, 246 const std::string& label,
240 const InternalDataChannelInit* config) override; 247 const InternalDataChannelInit* config) override;
241 248
242 cricket::DataChannelType data_channel_type() const; 249 cricket::DataChannelType data_channel_type() const;
243 250
244 bool IceRestartPending() const; 251 bool IceRestartPending() const;
245 252
246 void ResetIceRestartLatch(); 253 void ResetIceRestartLatch();
247 254
248 // Called when an SSLIdentity is generated or retrieved by 255 // Called when a DtlsCertificate is generated or retrieved by
249 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. 256 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription.
250 void OnIdentityReady(rtc::SSLIdentity* identity); 257 void OnCertificateReady(rtc::scoped_refptr<DtlsCertificate> certificate);
251 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); 258 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp);
252 259
253 // For unit test. 260 // For unit test.
254 bool waiting_for_identity() const; 261 bool waiting_for_certificate() const;
262 rtc::scoped_refptr<DtlsCertificate> get_certificate() const;
255 263
256 void set_metrics_observer( 264 void set_metrics_observer(
257 webrtc::MetricsObserverInterface* metrics_observer) { 265 webrtc::MetricsObserverInterface* metrics_observer) {
258 metrics_observer_ = metrics_observer; 266 metrics_observer_ = metrics_observer;
259 } 267 }
260 268
261 private: 269 private:
262 // Indicates the type of SessionDescription in a call to SetLocalDescription 270 // Indicates the type of SessionDescription in a call to SetLocalDescription
263 // and SetRemoteDescription. 271 // and SetRemoteDescription.
264 enum Action { 272 enum Action {
265 kOffer, 273 kOffer,
266 kPrAnswer, 274 kPrAnswer,
267 kAnswer, 275 kAnswer,
268 }; 276 };
269 277
278 bool InitializeCommon(
279 const PeerConnectionFactoryInterface::Options& options,
280 const MediaConstraintsInterface* constraints,
281 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
282 void InitializeFactoryAfterConstruction(
283 const PeerConnectionFactoryInterface::Options& options);
284
270 // Invokes ConnectChannels() on transport proxies, which initiates ice 285 // Invokes ConnectChannels() on transport proxies, which initiates ice
271 // candidates allocation. 286 // candidates allocation.
272 bool StartCandidatesAllocation(); 287 bool StartCandidatesAllocation();
273 bool UpdateSessionState(Action action, cricket::ContentSource source, 288 bool UpdateSessionState(Action action, cricket::ContentSource source,
274 std::string* err_desc); 289 std::string* err_desc);
275 static Action GetAction(const std::string& type); 290 static Action GetAction(const std::string& type);
276 // Push the media parts of the local or remote session description 291 // Push the media parts of the local or remote session description
277 // down to all of the channels. 292 // down to all of the channels.
278 bool PushdownMediaDescription(cricket::ContentAction action, 293 bool PushdownMediaDescription(cricket::ContentAction action,
279 cricket::ContentSource source, 294 cricket::ContentSource source,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 bool dtls_enabled_; 400 bool dtls_enabled_;
386 // Specifies which kind of data channel is allowed. This is controlled 401 // Specifies which kind of data channel is allowed. This is controlled
387 // by the chrome command-line flag and constraints: 402 // by the chrome command-line flag and constraints:
388 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, 403 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled,
389 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is 404 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is
390 // not set or false, SCTP is allowed (DCT_SCTP); 405 // not set or false, SCTP is allowed (DCT_SCTP);
391 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); 406 // 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). 407 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE).
393 cricket::DataChannelType data_channel_type_; 408 cricket::DataChannelType data_channel_type_;
394 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; 409 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_;
410 rtc::scoped_refptr<DtlsCertificate> certificate_;
395 411
396 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> 412 rtc::scoped_ptr<WebRtcSessionDescriptionFactory>
397 webrtc_session_desc_factory_; 413 webrtc_session_desc_factory_;
398 414
399 sigslot::signal0<> SignalVoiceChannelDestroyed; 415 sigslot::signal0<> SignalVoiceChannelDestroyed;
400 sigslot::signal0<> SignalVideoChannelDestroyed; 416 sigslot::signal0<> SignalVideoChannelDestroyed;
401 sigslot::signal0<> SignalDataChannelDestroyed; 417 sigslot::signal0<> SignalDataChannelDestroyed;
402 418
403 // Member variables for caching global options. 419 // Member variables for caching global options.
404 cricket::AudioOptions audio_options_; 420 cricket::AudioOptions audio_options_;
405 cricket::VideoOptions video_options_; 421 cricket::VideoOptions video_options_;
406 MetricsObserverInterface* metrics_observer_; 422 MetricsObserverInterface* metrics_observer_;
407 423
408 // Declares the bundle policy for the WebRTCSession. 424 // Declares the bundle policy for the WebRTCSession.
409 PeerConnectionInterface::BundlePolicy bundle_policy_; 425 PeerConnectionInterface::BundlePolicy bundle_policy_;
410 426
411 // Declares the RTCP mux policy for the WebRTCSession. 427 // Declares the RTCP mux policy for the WebRTCSession.
412 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; 428 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_;
413 429
414 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); 430 DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
415 }; 431 };
416 } // namespace webrtc 432 } // namespace webrtc
417 433
418 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ 434 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698