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 11 matching lines...) Expand all Loading... | |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
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 #include <vector> | |
32 | 33 |
33 #include "talk/app/webrtc/datachannel.h" | 34 #include "talk/app/webrtc/datachannel.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 |
44 namespace cricket { | 45 namespace cricket { |
45 | 46 |
46 class BaseChannel; | 47 class BaseChannel; |
47 class ChannelManager; | 48 class ChannelManager; |
48 class DataChannel; | 49 class DataChannel; |
49 class StatsReport; | 50 class StatsReport; |
50 class Transport; | |
51 class VideoCapturer; | 51 class VideoCapturer; |
52 class VideoChannel; | 52 class VideoChannel; |
53 class VoiceChannel; | 53 class VoiceChannel; |
54 | 54 |
55 } // namespace cricket | 55 } // namespace cricket |
56 | 56 |
57 namespace webrtc { | 57 namespace webrtc { |
58 | 58 |
59 class IceRestartAnswerLatch; | 59 class IceRestartAnswerLatch; |
60 class JsepIceCandidate; | 60 class JsepIceCandidate; |
61 class MediaStreamSignaling; | 61 class MediaStreamSignaling; |
62 class WebRtcSessionDescriptionFactory; | 62 class WebRtcSessionDescriptionFactory; |
63 | 63 |
64 extern const char kBundleWithoutRtcpMux[]; | 64 extern const char kBundleWithoutRtcpMux[]; |
65 extern const char kCreateChannelFailed[]; | 65 extern const char kCreateChannelFailed[]; |
66 extern const char kInvalidCandidates[]; | 66 extern const char kInvalidCandidates[]; |
67 extern const char kInvalidSdp[]; | 67 extern const char kInvalidSdp[]; |
68 extern const char kMlineMismatch[]; | 68 extern const char kMlineMismatch[]; |
69 extern const char kPushDownTDFailed[]; | 69 extern const char kPushDownTDFailed[]; |
70 extern const char kSdpWithoutDtlsFingerprint[]; | 70 extern const char kSdpWithoutDtlsFingerprint[]; |
71 extern const char kSdpWithoutSdesCrypto[]; | 71 extern const char kSdpWithoutSdesCrypto[]; |
72 extern const char kSdpWithoutIceUfragPwd[]; | 72 extern const char kSdpWithoutIceUfragPwd[]; |
73 extern const char kSdpWithoutSdesAndDtlsDisabled[]; | 73 extern const char kSdpWithoutSdesAndDtlsDisabled[]; |
74 extern const char kSessionError[]; | 74 extern const char kSessionError[]; |
75 extern const char kSessionErrorDesc[]; | 75 extern const char kSessionErrorDesc[]; |
76 extern const char kDtlsSetupFailureRtp[]; | 76 extern const char kDtlsSetupFailureRtp[]; |
77 extern const char kDtlsSetupFailureRtcp[]; | 77 extern const char kDtlsSetupFailureRtcp[]; |
78 extern const char kEnableBundleFailed[]; | |
79 | |
78 // Maximum number of received video streams that will be processed by webrtc | 80 // Maximum number of received video streams that will be processed by webrtc |
79 // even if they are not signalled beforehand. | 81 // even if they are not signalled beforehand. |
80 extern const int kMaxUnsignalledRecvStreams; | 82 extern const int kMaxUnsignalledRecvStreams; |
81 | 83 |
82 // ICE state callback interface. | 84 // ICE state callback interface. |
83 class IceObserver { | 85 class IceObserver { |
84 public: | 86 public: |
85 IceObserver() {} | 87 IceObserver() {} |
86 // Called any time the IceConnectionState changes | 88 // Called any time the IceConnectionState changes |
87 // TODO(honghaiz): Change the name to OnIceConnectionStateChange so as to | 89 // TODO(honghaiz): Change the name to OnIceConnectionStateChange so as to |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; | 229 bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; |
228 void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; | 230 void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; |
229 void AddSctpDataStream(int sid) override; | 231 void AddSctpDataStream(int sid) override; |
230 void RemoveSctpDataStream(int sid) override; | 232 void RemoveSctpDataStream(int sid) override; |
231 bool ReadyToSendData() const override; | 233 bool ReadyToSendData() const override; |
232 | 234 |
233 // Returns stats for all channels of all transports. | 235 // Returns stats for all channels of all transports. |
234 // This avoids exposing the internal structures used to track them. | 236 // This avoids exposing the internal structures used to track them. |
235 virtual bool GetTransportStats(cricket::SessionStats* stats); | 237 virtual bool GetTransportStats(cricket::SessionStats* stats); |
236 | 238 |
239 // Get stats for a specific channel | |
240 bool GetChannelTransportStats(cricket::BaseChannel* ch, | |
241 cricket::SessionStats* stats); | |
242 | |
243 // Caller owns returned identity | |
244 virtual bool GetIdentity(const std::string& content_name, | |
245 rtc::SSLIdentity** identity); | |
pthatcher1
2015/08/10 20:40:16
Can you run "git cl format"? The style here looks
Taylor Brandstetter
2015/08/11 01:20:07
Done.
| |
246 | |
247 // Caller owns returned certificate | |
248 virtual bool GetRemoteCertificate(const std::string& content_name, | |
249 rtc::SSLCertificate** cert); | |
250 | |
237 // Implements DataChannelFactory. | 251 // Implements DataChannelFactory. |
238 rtc::scoped_refptr<DataChannel> CreateDataChannel( | 252 rtc::scoped_refptr<DataChannel> CreateDataChannel( |
239 const std::string& label, | 253 const std::string& label, |
240 const InternalDataChannelInit* config) override; | 254 const InternalDataChannelInit* config) override; |
241 | 255 |
242 cricket::DataChannelType data_channel_type() const; | 256 cricket::DataChannelType data_channel_type() const; |
243 | 257 |
244 bool IceRestartPending() const; | 258 bool IceRestartPending() const; |
245 | 259 |
246 void ResetIceRestartLatch(); | 260 void ResetIceRestartLatch(); |
(...skipping 25 matching lines...) Expand all Loading... | |
272 bool StartCandidatesAllocation(); | 286 bool StartCandidatesAllocation(); |
273 bool UpdateSessionState(Action action, cricket::ContentSource source, | 287 bool UpdateSessionState(Action action, cricket::ContentSource source, |
274 std::string* err_desc); | 288 std::string* err_desc); |
275 static Action GetAction(const std::string& type); | 289 static Action GetAction(const std::string& type); |
276 // Push the media parts of the local or remote session description | 290 // Push the media parts of the local or remote session description |
277 // down to all of the channels. | 291 // down to all of the channels. |
278 bool PushdownMediaDescription(cricket::ContentAction action, | 292 bool PushdownMediaDescription(cricket::ContentAction action, |
279 cricket::ContentSource source, | 293 cricket::ContentSource source, |
280 std::string* error_desc); | 294 std::string* error_desc); |
281 | 295 |
282 | 296 cricket::BaseChannel* GetChannel(const std::string& content_name); |
283 // Transport related callbacks, override from cricket::BaseSession. | 297 // Cause all the BaseChannels in the bundle group to have the same |
284 virtual void OnTransportRequestSignaling(cricket::Transport* transport); | 298 // transport channel. |
285 virtual void OnTransportConnecting(cricket::Transport* transport); | 299 bool EnableBundle(const cricket::ContentGroup& bundle); |
286 virtual void OnTransportWritable(cricket::Transport* transport); | |
287 virtual void OnTransportCompleted(cricket::Transport* transport); | |
288 virtual void OnTransportFailed(cricket::Transport* transport); | |
289 virtual void OnTransportProxyCandidatesReady( | |
290 cricket::TransportProxy* proxy, | |
291 const cricket::Candidates& candidates); | |
292 virtual void OnCandidatesAllocationDone(); | |
293 void OnTransportReceiving(cricket::Transport* transport) override; | |
294 | 300 |
295 // Enables media channels to allow sending of media. | 301 // Enables media channels to allow sending of media. |
296 void EnableChannels(); | 302 void EnableChannels(); |
297 // Creates a JsepIceCandidate and adds it to the local session description | 303 // Creates a JsepIceCandidate and adds it to the local session description |
298 // and notify observers. Called when a new local candidate have been found. | 304 // and notify observers. Called when a new local candidate have been found. |
299 void ProcessNewLocalCandidate(const std::string& content_name, | 305 void ProcessNewLocalCandidate(const std::string& content_name, |
300 const cricket::Candidates& candidates); | 306 const cricket::Candidates& candidates); |
301 // Returns the media index for a local ice candidate given the content name. | 307 // Returns the media index for a local ice candidate given the content name. |
302 // Returns false if the local session description does not have a media | 308 // Returns false if the local session description does not have a media |
303 // content called |content_name|. | 309 // content called |content_name|. |
304 bool GetLocalCandidateMediaIndex(const std::string& content_name, | 310 bool GetLocalCandidateMediaIndex(const std::string& content_name, |
305 int* sdp_mline_index); | 311 int* sdp_mline_index); |
306 // Uses all remote candidates in |remote_desc| in this session. | 312 // Uses all remote candidates in |remote_desc| in this session. |
307 bool UseCandidatesInSessionDescription( | 313 bool UseCandidatesInSessionDescription( |
308 const SessionDescriptionInterface* remote_desc); | 314 const SessionDescriptionInterface* remote_desc); |
309 // Uses |candidate| in this session. | 315 // Uses |candidate| in this session. |
310 bool UseCandidate(const IceCandidateInterface* candidate); | 316 bool UseCandidate(const IceCandidateInterface* candidate); |
311 // Deletes the corresponding channel of contents that don't exist in |desc|. | 317 // Deletes the corresponding channel of contents that don't exist in |desc|. |
312 // |desc| can be null. This means that all channels are deleted. | 318 // |desc| can be null. This means that all channels are deleted. |
313 void RemoveUnusedChannelsAndTransports( | 319 void RemoveUnusedChannels( |
314 const cricket::SessionDescription* desc); | 320 const cricket::SessionDescription* desc); |
315 | 321 |
316 // Allocates media channels based on the |desc|. If |desc| doesn't have | 322 // Allocates media channels based on the |desc|. If |desc| doesn't have |
317 // the BUNDLE option, this method will disable BUNDLE in PortAllocator. | 323 // the BUNDLE option, this method will disable BUNDLE in PortAllocator. |
318 // This method will also delete any existing media channels before creating. | 324 // This method will also delete any existing media channels before creating. |
319 bool CreateChannels(const cricket::SessionDescription* desc); | 325 bool CreateChannels(const cricket::SessionDescription* desc); |
320 | 326 |
321 // Helper methods to create media channels. | 327 // Helper methods to create media channels. |
322 bool CreateVoiceChannel(const cricket::ContentInfo* content); | 328 bool CreateVoiceChannel(const cricket::ContentInfo* content); |
323 bool CreateVideoChannel(const cricket::ContentInfo* content); | 329 bool CreateVideoChannel(const cricket::ContentInfo* content); |
(...skipping 29 matching lines...) Expand all Loading... | |
353 Action action); | 359 Action action); |
354 | 360 |
355 // Returns true if we are ready to push down the remote candidate. | 361 // Returns true if we are ready to push down the remote candidate. |
356 // |remote_desc| is the new remote description, or NULL if the current remote | 362 // |remote_desc| is the new remote description, or NULL if the current remote |
357 // description should be used. Output |valid| is true if the candidate media | 363 // description should be used. Output |valid| is true if the candidate media |
358 // index is valid. | 364 // index is valid. |
359 bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate, | 365 bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate, |
360 const SessionDescriptionInterface* remote_desc, | 366 const SessionDescriptionInterface* remote_desc, |
361 bool* valid); | 367 bool* valid); |
362 | 368 |
369 void OnTransportControllerConnectionStateChanged( | |
370 cricket::TransportController::ConnectionState state); | |
371 void OnTransportControllerReceiving(bool receiving); | |
372 void OnTransportControllerCandidatesAllocationDone(); | |
373 void OnTransportControllerCandidatesAllocationStarted(); | |
pthatcher1
2015/08/10 20:40:17
While we're in here, can we change this to a Gathe
Taylor Brandstetter
2015/08/11 01:20:07
Done.
| |
374 void OnTransportControllerCandidatesReady( | |
pthatcher1
2015/08/10 20:40:16
And can we rename this to CandidatesGathered?
"ga
Taylor Brandstetter
2015/08/11 01:20:07
Done.
| |
375 const std::string& transport_name, const cricket::Candidates& candidates); | |
376 | |
363 std::string GetSessionErrorMsg(); | 377 std::string GetSessionErrorMsg(); |
364 | 378 |
365 // Invoked when OnTransportCompleted is signaled to gather the usage | 379 // Invoked when TransportController completion is signaled to gather the usage |
366 // of IPv4/IPv6 as best connection. | 380 // of IPv4/IPv6 as best connection. |
367 void ReportBestConnectionState(const cricket::TransportStats& stats); | 381 void ReportBestConnectionState(const cricket::TransportStats& stats); |
368 | 382 |
369 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); | 383 void ReportNegotiatedCiphers(const cricket::TransportStats& stats); |
370 | 384 |
371 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_; | 385 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_; |
372 rtc::scoped_ptr<cricket::VideoChannel> video_channel_; | 386 rtc::scoped_ptr<cricket::VideoChannel> video_channel_; |
373 rtc::scoped_ptr<cricket::DataChannel> data_channel_; | 387 rtc::scoped_ptr<cricket::DataChannel> data_channel_; |
374 cricket::ChannelManager* channel_manager_; | 388 cricket::ChannelManager* channel_manager_; |
375 MediaStreamSignaling* mediastream_signaling_; | 389 MediaStreamSignaling* mediastream_signaling_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 PeerConnectionInterface::BundlePolicy bundle_policy_; | 423 PeerConnectionInterface::BundlePolicy bundle_policy_; |
410 | 424 |
411 // Declares the RTCP mux policy for the WebRTCSession. | 425 // Declares the RTCP mux policy for the WebRTCSession. |
412 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; | 426 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; |
413 | 427 |
414 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 428 DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
415 }; | 429 }; |
416 } // namespace webrtc | 430 } // namespace webrtc |
417 | 431 |
418 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ | 432 #endif // TALK_APP_WEBRTC_WEBRTCSESSION_H_ |
OLD | NEW |