OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 typedef std::map<std::string, cricket::TransportStats> TransportStatsMap; | 108 typedef std::map<std::string, cricket::TransportStats> TransportStatsMap; |
109 typedef std::map<std::string, std::string> ProxyTransportMap; | 109 typedef std::map<std::string, std::string> ProxyTransportMap; |
110 | 110 |
111 // TODO(pthatcher): Think of a better name for this. We already have | 111 // TODO(pthatcher): Think of a better name for this. We already have |
112 // a TransportStats in transport.h. Perhaps TransportsStats? | 112 // a TransportStats in transport.h. Perhaps TransportsStats? |
113 struct SessionStats { | 113 struct SessionStats { |
114 ProxyTransportMap proxy_to_transport; | 114 ProxyTransportMap proxy_to_transport; |
115 TransportStatsMap transport_stats; | 115 TransportStatsMap transport_stats; |
116 }; | 116 }; |
117 | 117 |
118 struct ChannelNamePair { | |
119 ChannelNamePair( | |
120 const std::string& content_name, const std::string& transport_name) | |
121 : content_name(content_name), transport_name(transport_name) {} | |
122 std::string content_name; | |
123 std::string transport_name; | |
124 }; | |
125 | |
126 struct ChannelNamePairs { | |
127 rtc::Optional<ChannelNamePair> voice; | |
128 rtc::Optional<ChannelNamePair> video; | |
129 rtc::Optional<ChannelNamePair> data; | |
130 }; | |
131 | |
118 // A WebRtcSession manages general session state. This includes negotiation | 132 // A WebRtcSession manages general session state. This includes negotiation |
119 // of both the application-level and network-level protocols: the former | 133 // of both the application-level and network-level protocols: the former |
120 // defines what will be sent and the latter defines how it will be sent. Each | 134 // defines what will be sent and the latter defines how it will be sent. Each |
121 // network-level protocol is represented by a Transport object. Each Transport | 135 // network-level protocol is represented by a Transport object. Each Transport |
122 // participates in the network-level negotiation. The individual streams of | 136 // participates in the network-level negotiation. The individual streams of |
123 // packets are represented by TransportChannels. The application-level protocol | 137 // packets are represented by TransportChannels. The application-level protocol |
124 // is represented by SessionDecription objects. | 138 // is represented by SessionDecription objects. |
125 class WebRtcSession : | 139 class WebRtcSession : |
126 | 140 |
127 public DtmfProviderInterface, | 141 public DtmfProviderInterface, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 } | 200 } |
187 | 201 |
188 virtual cricket::VoiceChannel* voice_channel() { | 202 virtual cricket::VoiceChannel* voice_channel() { |
189 return voice_channel_.get(); | 203 return voice_channel_.get(); |
190 } | 204 } |
191 virtual cricket::VideoChannel* video_channel() { | 205 virtual cricket::VideoChannel* video_channel() { |
192 return video_channel_.get(); | 206 return video_channel_.get(); |
193 } | 207 } |
194 virtual cricket::DataChannel* data_channel() { | 208 virtual cricket::DataChannel* data_channel() { |
195 return data_channel_.get(); | 209 return data_channel_.get(); |
196 } | 210 } |
Taylor Brandstetter
2016/12/15 01:12:53
Could you add a brief comment explaining this meth
hbos
2016/12/15 16:12:45
Removed.
| |
211 std::unique_ptr<ChannelNamePairs> GetChannelNamePairs(); | |
197 | 212 |
198 cricket::BaseChannel* GetChannel(const std::string& content_name); | 213 cricket::BaseChannel* GetChannel(const std::string& content_name); |
199 | 214 |
200 void SetSdesPolicy(cricket::SecurePolicy secure_policy); | 215 void SetSdesPolicy(cricket::SecurePolicy secure_policy); |
201 cricket::SecurePolicy SdesPolicy() const; | 216 cricket::SecurePolicy SdesPolicy() const; |
202 | 217 |
203 // Get current ssl role from transport. | 218 // Get current ssl role from transport. |
204 bool GetSslRole(const std::string& transport_name, rtc::SSLRole* role); | 219 bool GetSslRole(const std::string& transport_name, rtc::SSLRole* role); |
205 | 220 |
206 // Get current SSL role for this channel's transport. | 221 // Get current SSL role for this channel's transport. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 const rtc::CopyOnWriteBuffer& payload, | 270 const rtc::CopyOnWriteBuffer& payload, |
256 cricket::SendDataResult* result) override; | 271 cricket::SendDataResult* result) override; |
257 bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; | 272 bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; |
258 void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; | 273 void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; |
259 void AddSctpDataStream(int sid) override; | 274 void AddSctpDataStream(int sid) override; |
260 void RemoveSctpDataStream(int sid) override; | 275 void RemoveSctpDataStream(int sid) override; |
261 bool ReadyToSendData() const override; | 276 bool ReadyToSendData() const override; |
262 | 277 |
263 // Returns stats for all channels of all transports. | 278 // Returns stats for all channels of all transports. |
264 // This avoids exposing the internal structures used to track them. | 279 // This avoids exposing the internal structures used to track them. |
265 virtual bool GetTransportStats(SessionStats* stats); | 280 std::unique_ptr<SessionStats> GetSessionStats(); |
Taylor Brandstetter
2016/12/15 01:12:54
This one too.
hbos
2016/12/15 16:12:45
Done.
| |
266 | 281 virtual std::unique_ptr<SessionStats> GetSessionStats( |
267 // Get stats for a specific channel | 282 const ChannelNamePairs& channel_name_pairs); |
268 bool GetChannelTransportStats(cricket::BaseChannel* ch, SessionStats* stats); | |
269 | 283 |
270 // virtual so it can be mocked in unit tests | 284 // virtual so it can be mocked in unit tests |
271 virtual bool GetLocalCertificate( | 285 virtual bool GetLocalCertificate( |
272 const std::string& transport_name, | 286 const std::string& transport_name, |
273 rtc::scoped_refptr<rtc::RTCCertificate>* certificate); | 287 rtc::scoped_refptr<rtc::RTCCertificate>* certificate); |
274 | 288 |
275 // Caller owns returned certificate | 289 // Caller owns returned certificate |
276 virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate( | 290 virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate( |
277 const std::string& transport_name); | 291 const std::string& transport_name); |
278 | 292 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 bool CreateChannels(const cricket::SessionDescription* desc); | 423 bool CreateChannels(const cricket::SessionDescription* desc); |
410 | 424 |
411 // Helper methods to create media channels. | 425 // Helper methods to create media channels. |
412 bool CreateVoiceChannel(const cricket::ContentInfo* content, | 426 bool CreateVoiceChannel(const cricket::ContentInfo* content, |
413 const std::string* bundle_transport); | 427 const std::string* bundle_transport); |
414 bool CreateVideoChannel(const cricket::ContentInfo* content, | 428 bool CreateVideoChannel(const cricket::ContentInfo* content, |
415 const std::string* bundle_transport); | 429 const std::string* bundle_transport); |
416 bool CreateDataChannel(const cricket::ContentInfo* content, | 430 bool CreateDataChannel(const cricket::ContentInfo* content, |
417 const std::string* bundle_transport); | 431 const std::string* bundle_transport); |
418 | 432 |
433 std::unique_ptr<SessionStats> GetSessionStats_n( | |
434 const ChannelNamePairs& channel_name_pairs); | |
435 | |
419 // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN | 436 // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN |
420 // messages. | 437 // messages. |
421 void OnDataChannelMessageReceived(cricket::DataChannel* channel, | 438 void OnDataChannelMessageReceived(cricket::DataChannel* channel, |
422 const cricket::ReceiveDataParams& params, | 439 const cricket::ReceiveDataParams& params, |
423 const rtc::CopyOnWriteBuffer& payload); | 440 const rtc::CopyOnWriteBuffer& payload); |
424 | 441 |
425 std::string BadStateErrMsg(State state); | 442 std::string BadStateErrMsg(State state); |
426 void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); | 443 void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state); |
427 void SetIceConnectionReceiving(bool receiving); | 444 void SetIceConnectionReceiving(bool receiving); |
428 | 445 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 rtc::Thread* const worker_thread_; | 496 rtc::Thread* const worker_thread_; |
480 rtc::Thread* const signaling_thread_; | 497 rtc::Thread* const signaling_thread_; |
481 | 498 |
482 State state_ = STATE_INIT; | 499 State state_ = STATE_INIT; |
483 Error error_ = ERROR_NONE; | 500 Error error_ = ERROR_NONE; |
484 std::string error_desc_; | 501 std::string error_desc_; |
485 | 502 |
486 const std::string sid_; | 503 const std::string sid_; |
487 bool initial_offerer_ = false; | 504 bool initial_offerer_ = false; |
488 | 505 |
489 std::unique_ptr<cricket::TransportController> transport_controller_; | 506 const std::unique_ptr<cricket::TransportController> transport_controller_; |
490 MediaControllerInterface* media_controller_; | 507 MediaControllerInterface* media_controller_; |
491 std::unique_ptr<cricket::VoiceChannel> voice_channel_; | 508 std::unique_ptr<cricket::VoiceChannel> voice_channel_; |
492 std::unique_ptr<cricket::VideoChannel> video_channel_; | 509 std::unique_ptr<cricket::VideoChannel> video_channel_; |
493 std::unique_ptr<cricket::DataChannel> data_channel_; | 510 std::unique_ptr<cricket::DataChannel> data_channel_; |
494 cricket::ChannelManager* channel_manager_; | 511 cricket::ChannelManager* channel_manager_; |
495 IceObserver* ice_observer_; | 512 IceObserver* ice_observer_; |
496 PeerConnectionInterface::IceConnectionState ice_connection_state_; | 513 PeerConnectionInterface::IceConnectionState ice_connection_state_; |
497 bool ice_connection_receiving_; | 514 bool ice_connection_receiving_; |
498 std::unique_ptr<SessionDescriptionInterface> local_desc_; | 515 std::unique_ptr<SessionDescriptionInterface> local_desc_; |
499 std::unique_ptr<SessionDescriptionInterface> remote_desc_; | 516 std::unique_ptr<SessionDescriptionInterface> remote_desc_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 | 548 |
532 #ifdef HAVE_QUIC | 549 #ifdef HAVE_QUIC |
533 std::unique_ptr<QuicDataTransport> quic_data_transport_; | 550 std::unique_ptr<QuicDataTransport> quic_data_transport_; |
534 #endif // HAVE_QUIC | 551 #endif // HAVE_QUIC |
535 | 552 |
536 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 553 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
537 }; | 554 }; |
538 } // namespace webrtc | 555 } // namespace webrtc |
539 | 556 |
540 #endif // WEBRTC_API_WEBRTCSESSION_H_ | 557 #endif // WEBRTC_API_WEBRTCSESSION_H_ |
OLD | NEW |