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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 cricket::IceConfig ParseIceConfig( | 240 cricket::IceConfig ParseIceConfig( |
241 const PeerConnectionInterface::RTCConfiguration& config) const; | 241 const PeerConnectionInterface::RTCConfiguration& config) const; |
242 | 242 |
243 void SetIceConfig(const cricket::IceConfig& ice_config); | 243 void SetIceConfig(const cricket::IceConfig& ice_config); |
244 | 244 |
245 // Start gathering candidates for any new transports, or transports doing an | 245 // Start gathering candidates for any new transports, or transports doing an |
246 // ICE restart. | 246 // ICE restart. |
247 void MaybeStartGathering(); | 247 void MaybeStartGathering(); |
248 | 248 |
249 const SessionDescriptionInterface* local_description() const { | 249 const SessionDescriptionInterface* local_description() const { |
250 return local_desc_.get(); | 250 return pending_local_description_ ? pending_local_description_.get() |
| 251 : current_local_description_.get(); |
251 } | 252 } |
252 const SessionDescriptionInterface* remote_description() const { | 253 const SessionDescriptionInterface* remote_description() const { |
253 return remote_desc_.get(); | 254 return pending_remote_description_ ? pending_remote_description_.get() |
| 255 : current_remote_description_.get(); |
| 256 } |
| 257 const SessionDescriptionInterface* current_local_description() const { |
| 258 return current_local_description_.get(); |
| 259 } |
| 260 const SessionDescriptionInterface* current_remote_description() const { |
| 261 return current_remote_description_.get(); |
| 262 } |
| 263 const SessionDescriptionInterface* pending_local_description() const { |
| 264 return pending_local_description_.get(); |
| 265 } |
| 266 const SessionDescriptionInterface* pending_remote_description() const { |
| 267 return pending_remote_description_.get(); |
254 } | 268 } |
255 | 269 |
256 // Get the id used as a media stream track's "id" field from ssrc. | 270 // Get the id used as a media stream track's "id" field from ssrc. |
257 virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); | 271 virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); |
258 virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); | 272 virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); |
259 | 273 |
260 // Implements DtmfProviderInterface. | 274 // Implements DtmfProviderInterface. |
261 bool CanInsertDtmf(const std::string& track_id) override; | 275 bool CanInsertDtmf(const std::string& track_id) override; |
262 bool InsertDtmf(const std::string& track_id, | 276 bool InsertDtmf(const std::string& track_id, |
263 int code, int duration) override; | 277 int code, int duration) override; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 361 |
348 private: | 362 private: |
349 // Indicates the type of SessionDescription in a call to SetLocalDescription | 363 // Indicates the type of SessionDescription in a call to SetLocalDescription |
350 // and SetRemoteDescription. | 364 // and SetRemoteDescription. |
351 enum Action { | 365 enum Action { |
352 kOffer, | 366 kOffer, |
353 kPrAnswer, | 367 kPrAnswer, |
354 kAnswer, | 368 kAnswer, |
355 }; | 369 }; |
356 | 370 |
| 371 // Non-const versions of local_description()/remote_description(), for use |
| 372 // internally. |
| 373 SessionDescriptionInterface* mutable_local_description() { |
| 374 return pending_local_description_ ? pending_local_description_.get() |
| 375 : current_local_description_.get(); |
| 376 } |
| 377 SessionDescriptionInterface* mutable_remote_description() { |
| 378 return pending_remote_description_ ? pending_remote_description_.get() |
| 379 : current_remote_description_.get(); |
| 380 } |
| 381 |
357 // Log session state. | 382 // Log session state. |
358 void LogState(State old_state, State new_state); | 383 void LogState(State old_state, State new_state); |
359 | 384 |
360 // Updates the state, signaling if necessary. | 385 // Updates the state, signaling if necessary. |
361 virtual void SetState(State state); | 386 virtual void SetState(State state); |
362 | 387 |
363 // Updates the error state, signaling if necessary. | 388 // Updates the error state, signaling if necessary. |
364 // TODO(ronghuawu): remove the SetError method that doesn't take |error_desc|. | 389 // TODO(ronghuawu): remove the SetError method that doesn't take |error_desc|. |
365 virtual void SetError(Error error, const std::string& error_desc); | 390 virtual void SetError(Error error, const std::string& error_desc); |
366 | 391 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 537 |
513 const std::unique_ptr<cricket::TransportController> transport_controller_; | 538 const std::unique_ptr<cricket::TransportController> transport_controller_; |
514 MediaControllerInterface* media_controller_; | 539 MediaControllerInterface* media_controller_; |
515 std::unique_ptr<cricket::VoiceChannel> voice_channel_; | 540 std::unique_ptr<cricket::VoiceChannel> voice_channel_; |
516 std::unique_ptr<cricket::VideoChannel> video_channel_; | 541 std::unique_ptr<cricket::VideoChannel> video_channel_; |
517 std::unique_ptr<cricket::DataChannel> data_channel_; | 542 std::unique_ptr<cricket::DataChannel> data_channel_; |
518 cricket::ChannelManager* channel_manager_; | 543 cricket::ChannelManager* channel_manager_; |
519 IceObserver* ice_observer_; | 544 IceObserver* ice_observer_; |
520 PeerConnectionInterface::IceConnectionState ice_connection_state_; | 545 PeerConnectionInterface::IceConnectionState ice_connection_state_; |
521 bool ice_connection_receiving_; | 546 bool ice_connection_receiving_; |
522 std::unique_ptr<SessionDescriptionInterface> local_desc_; | 547 std::unique_ptr<SessionDescriptionInterface> current_local_description_; |
523 std::unique_ptr<SessionDescriptionInterface> remote_desc_; | 548 std::unique_ptr<SessionDescriptionInterface> pending_local_description_; |
| 549 std::unique_ptr<SessionDescriptionInterface> current_remote_description_; |
| 550 std::unique_ptr<SessionDescriptionInterface> pending_remote_description_; |
524 // If the remote peer is using a older version of implementation. | 551 // If the remote peer is using a older version of implementation. |
525 bool older_version_remote_peer_; | 552 bool older_version_remote_peer_; |
526 bool dtls_enabled_; | 553 bool dtls_enabled_; |
527 // Specifies which kind of data channel is allowed. This is controlled | 554 // Specifies which kind of data channel is allowed. This is controlled |
528 // by the chrome command-line flag and constraints: | 555 // by the chrome command-line flag and constraints: |
529 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, | 556 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, |
530 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is | 557 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is |
531 // not set or false, SCTP is allowed (DCT_SCTP); | 558 // not set or false, SCTP is allowed (DCT_SCTP); |
532 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); | 559 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); |
533 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). | 560 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). |
(...skipping 21 matching lines...) Expand all Loading... |
555 | 582 |
556 #ifdef HAVE_QUIC | 583 #ifdef HAVE_QUIC |
557 std::unique_ptr<QuicDataTransport> quic_data_transport_; | 584 std::unique_ptr<QuicDataTransport> quic_data_transport_; |
558 #endif // HAVE_QUIC | 585 #endif // HAVE_QUIC |
559 | 586 |
560 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 587 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
561 }; | 588 }; |
562 } // namespace webrtc | 589 } // namespace webrtc |
563 | 590 |
564 #endif // WEBRTC_API_WEBRTCSESSION_H_ | 591 #endif // WEBRTC_API_WEBRTCSESSION_H_ |
OLD | NEW |