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

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

Issue 1403633005: Revert of Moving MediaStreamSignaling logic into PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « talk/app/webrtc/statscollector_unittest.cc ('k') | talk/app/webrtc/webrtcsession.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 protected: 108 protected:
109 ~IceObserver() {} 109 ~IceObserver() {}
110 110
111 private: 111 private:
112 RTC_DISALLOW_COPY_AND_ASSIGN(IceObserver); 112 RTC_DISALLOW_COPY_AND_ASSIGN(IceObserver);
113 }; 113 };
114 114
115 class WebRtcSession : public cricket::BaseSession, 115 class WebRtcSession : public cricket::BaseSession,
116 public AudioProviderInterface, 116 public AudioProviderInterface,
117 public DataChannelFactory,
117 public VideoProviderInterface, 118 public VideoProviderInterface,
118 public DtmfProviderInterface, 119 public DtmfProviderInterface,
119 public DataChannelProviderInterface { 120 public DataChannelProviderInterface {
120 public: 121 public:
121 WebRtcSession(cricket::ChannelManager* channel_manager, 122 WebRtcSession(cricket::ChannelManager* channel_manager,
122 rtc::Thread* signaling_thread, 123 rtc::Thread* signaling_thread,
123 rtc::Thread* worker_thread, 124 rtc::Thread* worker_thread,
124 cricket::PortAllocator* port_allocator); 125 cricket::PortAllocator* port_allocator,
126 MediaStreamSignaling* mediastream_signaling);
125 virtual ~WebRtcSession(); 127 virtual ~WebRtcSession();
126 128
127 bool Initialize( 129 bool Initialize(
128 const PeerConnectionFactoryInterface::Options& options, 130 const PeerConnectionFactoryInterface::Options& options,
129 const MediaConstraintsInterface* constraints, 131 const MediaConstraintsInterface* constraints,
130 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 132 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
131 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); 133 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
132 // Deletes the voice, video and data channel and changes the session state 134 // Deletes the voice, video and data channel and changes the session state
133 // to STATE_RECEIVEDTERMINATE. 135 // to STATE_RECEIVEDTERMINATE.
134 void Terminate(); 136 void Terminate();
135 137
136 void RegisterIceObserver(IceObserver* observer) { 138 void RegisterIceObserver(IceObserver* observer) {
137 ice_observer_ = observer; 139 ice_observer_ = observer;
138 } 140 }
139 141
140 virtual cricket::VoiceChannel* voice_channel() { 142 virtual cricket::VoiceChannel* voice_channel() {
141 return voice_channel_.get(); 143 return voice_channel_.get();
142 } 144 }
143 virtual cricket::VideoChannel* video_channel() { 145 virtual cricket::VideoChannel* video_channel() {
144 return video_channel_.get(); 146 return video_channel_.get();
145 } 147 }
146 virtual cricket::DataChannel* data_channel() { 148 virtual cricket::DataChannel* data_channel() {
147 return data_channel_.get(); 149 return data_channel_.get();
148 } 150 }
149 151
152 virtual const MediaStreamSignaling* mediastream_signaling() const {
153 return mediastream_signaling_;
154 }
155
150 void SetSdesPolicy(cricket::SecurePolicy secure_policy); 156 void SetSdesPolicy(cricket::SecurePolicy secure_policy);
151 cricket::SecurePolicy SdesPolicy() const; 157 cricket::SecurePolicy SdesPolicy() const;
152 158
153 // Get current ssl role from transport. 159 // Get current ssl role from transport.
154 bool GetSslRole(rtc::SSLRole* role); 160 bool GetSslRole(rtc::SSLRole* role);
155 161
156 // Generic error message callback from WebRtcSession. 162 // Generic error message callback from WebRtcSession.
157 // TODO - It may be necessary to supply error code as well. 163 // TODO - It may be necessary to supply error code as well.
158 sigslot::signal0<> SignalError; 164 sigslot::signal0<> SignalError;
159 165
160 void CreateOffer( 166 void CreateOffer(
161 CreateSessionDescriptionObserver* observer, 167 CreateSessionDescriptionObserver* observer,
162 const PeerConnectionInterface::RTCOfferAnswerOptions& options, 168 const PeerConnectionInterface::RTCOfferAnswerOptions& options);
163 const cricket::MediaSessionOptions& session_options);
164 void CreateAnswer(CreateSessionDescriptionObserver* observer, 169 void CreateAnswer(CreateSessionDescriptionObserver* observer,
165 const MediaConstraintsInterface* constraints, 170 const MediaConstraintsInterface* constraints);
166 const cricket::MediaSessionOptions& session_options);
167 // The ownership of |desc| will be transferred after this call. 171 // The ownership of |desc| will be transferred after this call.
168 bool SetLocalDescription(SessionDescriptionInterface* desc, 172 bool SetLocalDescription(SessionDescriptionInterface* desc,
169 std::string* err_desc); 173 std::string* err_desc);
170 // The ownership of |desc| will be transferred after this call. 174 // The ownership of |desc| will be transferred after this call.
171 bool SetRemoteDescription(SessionDescriptionInterface* desc, 175 bool SetRemoteDescription(SessionDescriptionInterface* desc,
172 std::string* err_desc); 176 std::string* err_desc);
173 bool ProcessIceMessage(const IceCandidateInterface* ice_candidate); 177 bool ProcessIceMessage(const IceCandidateInterface* ice_candidate);
174 178
175 bool SetIceTransports(PeerConnectionInterface::IceTransportsType type); 179 bool SetIceTransports(PeerConnectionInterface::IceTransportsType type);
176 180
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 244
241 // virtual so it can be mocked in unit tests 245 // virtual so it can be mocked in unit tests
242 virtual bool GetLocalCertificate( 246 virtual bool GetLocalCertificate(
243 const std::string& transport_name, 247 const std::string& transport_name,
244 rtc::scoped_refptr<rtc::RTCCertificate>* certificate); 248 rtc::scoped_refptr<rtc::RTCCertificate>* certificate);
245 249
246 // Caller owns returned certificate 250 // Caller owns returned certificate
247 virtual bool GetRemoteSSLCertificate(const std::string& transport_name, 251 virtual bool GetRemoteSSLCertificate(const std::string& transport_name,
248 rtc::SSLCertificate** cert); 252 rtc::SSLCertificate** cert);
249 253
254 // Implements DataChannelFactory.
255 rtc::scoped_refptr<DataChannel> CreateDataChannel(
256 const std::string& label,
257 const InternalDataChannelInit* config) override;
258
250 cricket::DataChannelType data_channel_type() const; 259 cricket::DataChannelType data_channel_type() const;
251 260
252 bool IceRestartPending() const; 261 bool IceRestartPending() const;
253 262
254 void ResetIceRestartLatch(); 263 void ResetIceRestartLatch();
255 264
256 // Called when an RTCCertificate is generated or retrieved by 265 // Called when an RTCCertificate is generated or retrieved by
257 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. 266 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription.
258 void OnCertificateReady( 267 void OnCertificateReady(
259 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); 268 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
260 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); 269 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp);
261 270
262 // For unit test. 271 // For unit test.
263 bool waiting_for_certificate_for_testing() const; 272 bool waiting_for_certificate_for_testing() const;
264 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); 273 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing();
265 274
266 void set_metrics_observer( 275 void set_metrics_observer(
267 webrtc::MetricsObserverInterface* metrics_observer) { 276 webrtc::MetricsObserverInterface* metrics_observer) {
268 metrics_observer_ = metrics_observer; 277 metrics_observer_ = metrics_observer;
269 } 278 }
270 279
271 // Called when voice_channel_, video_channel_ and data_channel_ are created
272 // and destroyed. As a result of, for example, setting a new description.
273 sigslot::signal0<> SignalVoiceChannelCreated;
274 sigslot::signal0<> SignalVoiceChannelDestroyed;
275 sigslot::signal0<> SignalVideoChannelCreated;
276 sigslot::signal0<> SignalVideoChannelDestroyed;
277 sigslot::signal0<> SignalDataChannelCreated;
278 sigslot::signal0<> SignalDataChannelDestroyed;
279
280 // Called when a valid data channel OPEN message is received.
281 // std::string represents the data channel label.
282 sigslot::signal2<const std::string&, const InternalDataChannelInit&>
283 SignalDataChannelOpenMessage;
284
285 private: 280 private:
286 // Indicates the type of SessionDescription in a call to SetLocalDescription 281 // Indicates the type of SessionDescription in a call to SetLocalDescription
287 // and SetRemoteDescription. 282 // and SetRemoteDescription.
288 enum Action { 283 enum Action {
289 kOffer, 284 kOffer,
290 kPrAnswer, 285 kPrAnswer,
291 kAnswer, 286 kAnswer,
292 }; 287 };
293 288
294 bool UpdateSessionState(Action action, cricket::ContentSource source, 289 bool UpdateSessionState(Action action, cricket::ContentSource source,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // Gather the usage of IPv4/IPv6 as best connection. 379 // Gather the usage of IPv4/IPv6 as best connection.
385 void ReportBestConnectionState(const cricket::TransportStats& stats); 380 void ReportBestConnectionState(const cricket::TransportStats& stats);
386 381
387 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); 382 void ReportNegotiatedCiphers(const cricket::TransportStats& stats);
388 383
389 rtc::scoped_ptr<MediaControllerInterface> media_controller_; 384 rtc::scoped_ptr<MediaControllerInterface> media_controller_;
390 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_; 385 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_;
391 rtc::scoped_ptr<cricket::VideoChannel> video_channel_; 386 rtc::scoped_ptr<cricket::VideoChannel> video_channel_;
392 rtc::scoped_ptr<cricket::DataChannel> data_channel_; 387 rtc::scoped_ptr<cricket::DataChannel> data_channel_;
393 cricket::ChannelManager* channel_manager_; 388 cricket::ChannelManager* channel_manager_;
389 MediaStreamSignaling* mediastream_signaling_;
394 IceObserver* ice_observer_; 390 IceObserver* ice_observer_;
395 PeerConnectionInterface::IceConnectionState ice_connection_state_; 391 PeerConnectionInterface::IceConnectionState ice_connection_state_;
396 bool ice_connection_receiving_; 392 bool ice_connection_receiving_;
397 rtc::scoped_ptr<SessionDescriptionInterface> local_desc_; 393 rtc::scoped_ptr<SessionDescriptionInterface> local_desc_;
398 rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_; 394 rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_;
399 // Candidates that arrived before the remote description was set. 395 // Candidates that arrived before the remote description was set.
400 std::vector<IceCandidateInterface*> saved_candidates_; 396 std::vector<IceCandidateInterface*> saved_candidates_;
401 // If the remote peer is using a older version of implementation. 397 // If the remote peer is using a older version of implementation.
402 bool older_version_remote_peer_; 398 bool older_version_remote_peer_;
403 bool dtls_enabled_; 399 bool dtls_enabled_;
404 // Specifies which kind of data channel is allowed. This is controlled 400 // Specifies which kind of data channel is allowed. This is controlled
405 // by the chrome command-line flag and constraints: 401 // by the chrome command-line flag and constraints:
406 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, 402 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled,
407 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is 403 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is
408 // not set or false, SCTP is allowed (DCT_SCTP); 404 // not set or false, SCTP is allowed (DCT_SCTP);
409 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); 405 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP);
410 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). 406 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE).
411 cricket::DataChannelType data_channel_type_; 407 cricket::DataChannelType data_channel_type_;
412 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; 408 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_;
413 409
414 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> 410 rtc::scoped_ptr<WebRtcSessionDescriptionFactory>
415 webrtc_session_desc_factory_; 411 webrtc_session_desc_factory_;
416 412
413 sigslot::signal0<> SignalVoiceChannelDestroyed;
414 sigslot::signal0<> SignalVideoChannelDestroyed;
415 sigslot::signal0<> SignalDataChannelDestroyed;
416
417 // Member variables for caching global options. 417 // Member variables for caching global options.
418 cricket::AudioOptions audio_options_; 418 cricket::AudioOptions audio_options_;
419 cricket::VideoOptions video_options_; 419 cricket::VideoOptions video_options_;
420 MetricsObserverInterface* metrics_observer_; 420 MetricsObserverInterface* metrics_observer_;
421 421
422 // Declares the bundle policy for the WebRTCSession. 422 // Declares the bundle policy for the WebRTCSession.
423 PeerConnectionInterface::BundlePolicy bundle_policy_; 423 PeerConnectionInterface::BundlePolicy bundle_policy_;
424 424
425 // Declares the RTCP mux policy for the WebRTCSession. 425 // Declares the RTCP mux policy for the WebRTCSession.
426 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; 426 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_;
427 427
428 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); 428 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
429 }; 429 };
430 } // namespace webrtc 430 } // namespace webrtc
431 431
432 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ 432 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/statscollector_unittest.cc ('k') | talk/app/webrtc/webrtcsession.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698