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

Side by Side Diff: webrtc/api/webrtcsession.cc

Issue 2013523002: Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: The side dish: Update ambigous calls Created 4 years, 7 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
OLDNEW
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
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<DtlsIdentityStoreInterface> dtls_identity_store, 515 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
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_ = (dtls_identity_store || certificate); 536 dtls_enabled_ = (cert_generator || 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
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>()));
570 } else { 571 } else {
571 // Construct with DTLS enabled. 572 // Construct with DTLS enabled.
572 if (!certificate) { 573 if (!certificate) {
573 // Use the |dtls_identity_store| to generate a certificate.
574 RTC_DCHECK(dtls_identity_store);
575 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( 574 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory(
576 signaling_thread(), channel_manager_, std::move(dtls_identity_store), 575 signaling_thread(), channel_manager_, this, id(),
577 this, id())); 576 std::move(cert_generator)));
578 } else { 577 } else {
579 // Use the already generated certificate. 578 // Use the already generated certificate.
580 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( 579 webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory(
581 signaling_thread(), channel_manager_, certificate, this, id())); 580 signaling_thread(), channel_manager_, this, id(), certificate));
582 } 581 }
583 } 582 }
584 583
585 webrtc_session_desc_factory_->SignalCertificateReady.connect( 584 webrtc_session_desc_factory_->SignalCertificateReady.connect(
586 this, &WebRtcSession::OnCertificateReady); 585 this, &WebRtcSession::OnCertificateReady);
587 586
588 if (options.disable_encryption) { 587 if (options.disable_encryption) {
589 webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED); 588 webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED);
590 } 589 }
591 590
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 ssl_cipher_suite); 2191 ssl_cipher_suite);
2193 } 2192 }
2194 } 2193 }
2195 2194
2196 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { 2195 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) {
2197 RTC_DCHECK(worker_thread()->IsCurrent()); 2196 RTC_DCHECK(worker_thread()->IsCurrent());
2198 media_controller_->call_w()->OnSentPacket(sent_packet); 2197 media_controller_->call_w()->OnSentPacket(sent_packet);
2199 } 2198 }
2200 2199
2201 } // namespace webrtc 2200 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698