| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 SignalDataChannelDestroyed(); | 505 SignalDataChannelDestroyed(); |
| 506 channel_manager_->DestroyDataChannel(data_channel_.release()); | 506 channel_manager_->DestroyDataChannel(data_channel_.release()); |
| 507 } | 507 } |
| 508 SignalDestroyed(); | 508 SignalDestroyed(); |
| 509 | 509 |
| 510 LOG(LS_INFO) << "Session: " << id() << " is destroyed."; | 510 LOG(LS_INFO) << "Session: " << id() << " is destroyed."; |
| 511 } | 511 } |
| 512 | 512 |
| 513 bool WebRtcSession::Initialize( | 513 bool WebRtcSession::Initialize( |
| 514 const PeerConnectionFactoryInterface::Options& options, | 514 const PeerConnectionFactoryInterface::Options& options, |
| 515 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, | 515 std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 516 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { | 516 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { |
| 517 bundle_policy_ = rtc_configuration.bundle_policy; | 517 bundle_policy_ = rtc_configuration.bundle_policy; |
| 518 rtcp_mux_policy_ = rtc_configuration.rtcp_mux_policy; | 518 rtcp_mux_policy_ = rtc_configuration.rtcp_mux_policy; |
| 519 transport_controller_->SetSslMaxProtocolVersion(options.ssl_max_version); | 519 transport_controller_->SetSslMaxProtocolVersion(options.ssl_max_version); |
| 520 | 520 |
| 521 // Obtain a certificate from RTCConfiguration if any were provided (optional). | 521 // Obtain a certificate from RTCConfiguration if any were provided (optional). |
| 522 rtc::scoped_refptr<rtc::RTCCertificate> certificate; | 522 rtc::scoped_refptr<rtc::RTCCertificate> certificate; |
| 523 if (!rtc_configuration.certificates.empty()) { | 523 if (!rtc_configuration.certificates.empty()) { |
| 524 // TODO(hbos,torbjorng): Decide on certificate-selection strategy instead of | 524 // TODO(hbos,torbjorng): Decide on certificate-selection strategy instead of |
| 525 // just picking the first one. The decision should be made based on the DTLS | 525 // just picking the first one. The decision should be made based on the DTLS |
| 526 // handshake. The DTLS negotiations need to know about all certificates. | 526 // handshake. The DTLS negotiations need to know about all certificates. |
| 527 certificate = rtc_configuration.certificates[0]; | 527 certificate = rtc_configuration.certificates[0]; |
| 528 } | 528 } |
| 529 | 529 |
| 530 SetIceConfig(ParseIceConfig(rtc_configuration)); | 530 SetIceConfig(ParseIceConfig(rtc_configuration)); |
| 531 | 531 |
| 532 if (options.disable_encryption) { | 532 if (options.disable_encryption) { |
| 533 dtls_enabled_ = false; | 533 dtls_enabled_ = false; |
| 534 } else { | 534 } else { |
| 535 // Enable DTLS by default if we have an identity store or a certificate. | 535 // Enable DTLS by default if we have an identity store or a certificate. |
| 536 dtls_enabled_ = (cert_generator || certificate); | 536 dtls_enabled_ = (dtls_identity_store || certificate); |
| 537 // |rtc_configuration| can override the default |dtls_enabled_| value. | 537 // |rtc_configuration| can override the default |dtls_enabled_| value. |
| 538 if (rtc_configuration.enable_dtls_srtp) { | 538 if (rtc_configuration.enable_dtls_srtp) { |
| 539 dtls_enabled_ = *(rtc_configuration.enable_dtls_srtp); | 539 dtls_enabled_ = *(rtc_configuration.enable_dtls_srtp); |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 | 542 |
| 543 // Enable creation of RTP data channels if the kEnableRtpDataChannels is set. | 543 // Enable creation of RTP data channels if the kEnableRtpDataChannels is set. |
| 544 // It takes precendence over the disable_sctp_data_channels | 544 // It takes precendence over the disable_sctp_data_channels |
| 545 // PeerConnectionFactoryInterface::Options. | 545 // PeerConnectionFactoryInterface::Options. |
| 546 if (rtc_configuration.enable_rtp_data_channel) { | 546 if (rtc_configuration.enable_rtp_data_channel) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 559 | 559 |
| 560 audio_options_.audio_jitter_buffer_max_packets = | 560 audio_options_.audio_jitter_buffer_max_packets = |
| 561 rtc::Optional<int>(rtc_configuration.audio_jitter_buffer_max_packets); | 561 rtc::Optional<int>(rtc_configuration.audio_jitter_buffer_max_packets); |
| 562 | 562 |
| 563 audio_options_.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>( | 563 audio_options_.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>( |
| 564 rtc_configuration.audio_jitter_buffer_fast_accelerate); | 564 rtc_configuration.audio_jitter_buffer_fast_accelerate); |
| 565 | 565 |
| 566 if (!dtls_enabled_) { | 566 if (!dtls_enabled_) { |
| 567 // Construct with DTLS disabled. | 567 // Construct with DTLS disabled. |
| 568 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( | 568 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( |
| 569 signaling_thread(), channel_manager_, this, id(), | 569 signaling_thread(), channel_manager_, this, id())); |
| 570 std::unique_ptr<rtc::RTCCertificateGeneratorInterface>())); | |
| 571 } else { | 570 } else { |
| 572 // Construct with DTLS enabled. | 571 // Construct with DTLS enabled. |
| 573 if (!certificate) { | 572 if (!certificate) { |
| 573 // Use the |dtls_identity_store| to generate a certificate. |
| 574 RTC_DCHECK(dtls_identity_store); |
| 574 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( | 575 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( |
| 575 signaling_thread(), channel_manager_, this, id(), | 576 signaling_thread(), channel_manager_, std::move(dtls_identity_store), |
| 576 std::move(cert_generator))); | 577 this, id())); |
| 577 } else { | 578 } else { |
| 578 // Use the already generated certificate. | 579 // Use the already generated certificate. |
| 579 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( | 580 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( |
| 580 signaling_thread(), channel_manager_, this, id(), certificate)); | 581 signaling_thread(), channel_manager_, certificate, this, id())); |
| 581 } | 582 } |
| 582 } | 583 } |
| 583 | 584 |
| 584 webrtc_session_desc_factory_->SignalCertificateReady.connect( | 585 webrtc_session_desc_factory_->SignalCertificateReady.connect( |
| 585 this, &WebRtcSession::OnCertificateReady); | 586 this, &WebRtcSession::OnCertificateReady); |
| 586 | 587 |
| 587 if (options.disable_encryption) { | 588 if (options.disable_encryption) { |
| 588 webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED); | 589 webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED); |
| 589 } | 590 } |
| 590 | 591 |
| (...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 ssl_cipher_suite); | 2192 ssl_cipher_suite); |
| 2192 } | 2193 } |
| 2193 } | 2194 } |
| 2194 | 2195 |
| 2195 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { | 2196 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { |
| 2196 RTC_DCHECK(worker_thread()->IsCurrent()); | 2197 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 2197 media_controller_->call_w()->OnSentPacket(sent_packet); | 2198 media_controller_->call_w()->OnSentPacket(sent_packet); |
| 2198 } | 2199 } |
| 2199 | 2200 |
| 2200 } // namespace webrtc | 2201 } // namespace webrtc |
| OLD | NEW |