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

Side by Side Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 1979553002: WebRTC: Launch ECDSA as default certificate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/public/common/content_features.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/rtc_peer_connection_handler.h" 5 #include "content/renderer/media/rtc_peer_connection_handler.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 constraints, &blink::WebMediaTrackConstraintSet::voiceActivityDetection, 715 constraints, &blink::WebMediaTrackConstraintSet::voiceActivityDetection,
716 &output->voice_activity_detection); 716 &output->voice_activity_detection);
717 GetConstraintValueAsBoolean(constraints, 717 GetConstraintValueAsBoolean(constraints,
718 &blink::WebMediaTrackConstraintSet::iceRestart, 718 &blink::WebMediaTrackConstraintSet::iceRestart,
719 &output->ice_restart); 719 &output->ice_restart);
720 } 720 }
721 721
722 base::LazyInstance<std::set<RTCPeerConnectionHandler*> >::Leaky 722 base::LazyInstance<std::set<RTCPeerConnectionHandler*> >::Leaky
723 g_peer_connection_handlers = LAZY_INSTANCE_INITIALIZER; 723 g_peer_connection_handlers = LAZY_INSTANCE_INITIALIZER;
724 724
725 void OverrideDefaultCertificateBasedOnExperiment(
726 webrtc::PeerConnectionInterface::RTCConfiguration* config) {
727 if (base::FeatureList::IsEnabled(features::kWebRtcEcdsaDefault)) {
728 if (config->certificates.empty()) {
729 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
730 PeerConnectionDependencyFactory::GenerateDefaultCertificate();
731 config->certificates.push_back(certificate);
732 }
733 }
734 // If the ECDSA experiment is not running we rely on the default being RSA for
735 // the control group. See bug related to this: crbug.com/611698.
736 DCHECK(rtc::KT_DEFAULT == rtc::KT_RSA);
tommi (sloooow) - chröme 2016/05/13 13:27:06 Did you mean to do a static (compile time) assert
hbos_chromium 2016/05/13 14:35:31 Done.
737 }
738
725 } // namespace 739 } // namespace
726 740
727 // Implementation of LocalRTCStatsRequest. 741 // Implementation of LocalRTCStatsRequest.
728 LocalRTCStatsRequest::LocalRTCStatsRequest(blink::WebRTCStatsRequest impl) 742 LocalRTCStatsRequest::LocalRTCStatsRequest(blink::WebRTCStatsRequest impl)
729 : impl_(impl) { 743 : impl_(impl) {
730 } 744 }
731 745
732 LocalRTCStatsRequest::LocalRTCStatsRequest() {} 746 LocalRTCStatsRequest::LocalRTCStatsRequest() {}
733 LocalRTCStatsRequest::~LocalRTCStatsRequest() {} 747 LocalRTCStatsRequest::~LocalRTCStatsRequest() {}
734 748
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 const blink::WebRTCConfiguration& server_configuration, 959 const blink::WebRTCConfiguration& server_configuration,
946 const blink::WebMediaConstraints& options) { 960 const blink::WebMediaConstraints& options) {
947 DCHECK(thread_checker_.CalledOnValidThread()); 961 DCHECK(thread_checker_.CalledOnValidThread());
948 DCHECK(frame_); 962 DCHECK(frame_);
949 963
950 peer_connection_tracker_ = 964 peer_connection_tracker_ =
951 RenderThreadImpl::current()->peer_connection_tracker()->AsWeakPtr(); 965 RenderThreadImpl::current()->peer_connection_tracker()->AsWeakPtr();
952 966
953 webrtc::PeerConnectionInterface::RTCConfiguration config; 967 webrtc::PeerConnectionInterface::RTCConfiguration config;
954 GetNativeRtcConfiguration(server_configuration, &config); 968 GetNativeRtcConfiguration(server_configuration, &config);
955 969 OverrideDefaultCertificateBasedOnExperiment(&config);
956 if (base::FeatureList::IsEnabled(features::kWebRtcEcdsaDefault)) {
957 if (config.certificates.empty()) {
958 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
959 PeerConnectionDependencyFactory::GenerateDefaultCertificate();
960 config.certificates.push_back(certificate);
961 }
962 }
963 970
964 // Choose between RTC smoothness algorithm and prerenderer smoothing. 971 // Choose between RTC smoothness algorithm and prerenderer smoothing.
965 // Prerenderer smoothing is turned on if RTC smoothness is turned off. 972 // Prerenderer smoothing is turned on if RTC smoothness is turned off.
966 config.set_prerenderer_smoothing( 973 config.set_prerenderer_smoothing(
967 base::CommandLine::ForCurrentProcess()->HasSwitch( 974 base::CommandLine::ForCurrentProcess()->HasSwitch(
968 switches::kDisableRTCSmoothnessAlgorithm)); 975 switches::kDisableRTCSmoothnessAlgorithm));
969 976
970 // Copy all the relevant constraints into |config|. 977 // Copy all the relevant constraints into |config|.
971 CopyConstraintsIntoRtcConfiguration(options, &config); 978 CopyConstraintsIntoRtcConfiguration(options, &config);
972 979
(...skipping 16 matching lines...) Expand all
989 return true; 996 return true;
990 } 997 }
991 998
992 bool RTCPeerConnectionHandler::InitializeForTest( 999 bool RTCPeerConnectionHandler::InitializeForTest(
993 const blink::WebRTCConfiguration& server_configuration, 1000 const blink::WebRTCConfiguration& server_configuration,
994 const blink::WebMediaConstraints& options, 1001 const blink::WebMediaConstraints& options,
995 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker) { 1002 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker) {
996 DCHECK(thread_checker_.CalledOnValidThread()); 1003 DCHECK(thread_checker_.CalledOnValidThread());
997 webrtc::PeerConnectionInterface::RTCConfiguration config; 1004 webrtc::PeerConnectionInterface::RTCConfiguration config;
998 GetNativeRtcConfiguration(server_configuration, &config); 1005 GetNativeRtcConfiguration(server_configuration, &config);
999 1006 OverrideDefaultCertificateBasedOnExperiment(&config);
1000 if (base::FeatureList::IsEnabled(features::kWebRtcEcdsaDefault)) {
1001 if (config.certificates.empty()) {
1002 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
1003 PeerConnectionDependencyFactory::GenerateDefaultCertificate();
1004 config.certificates.push_back(certificate);
1005 }
1006 }
1007 1007
1008 peer_connection_observer_ = new Observer(weak_factory_.GetWeakPtr()); 1008 peer_connection_observer_ = new Observer(weak_factory_.GetWeakPtr());
1009 CopyConstraintsIntoRtcConfiguration(options, &config); 1009 CopyConstraintsIntoRtcConfiguration(options, &config);
1010 1010
1011 native_peer_connection_ = dependency_factory_->CreatePeerConnection( 1011 native_peer_connection_ = dependency_factory_->CreatePeerConnection(
1012 config, nullptr, peer_connection_observer_.get()); 1012 config, nullptr, peer_connection_observer_.get());
1013 if (!native_peer_connection_.get()) { 1013 if (!native_peer_connection_.get()) {
1014 LOG(ERROR) << "Failed to initialize native PeerConnection."; 1014 LOG(ERROR) << "Failed to initialize native PeerConnection.";
1015 return false; 1015 return false;
1016 } 1016 }
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 } 1798 }
1799 1799
1800 void RTCPeerConnectionHandler::ResetUMAStats() { 1800 void RTCPeerConnectionHandler::ResetUMAStats() {
1801 DCHECK(thread_checker_.CalledOnValidThread()); 1801 DCHECK(thread_checker_.CalledOnValidThread());
1802 num_local_candidates_ipv6_ = 0; 1802 num_local_candidates_ipv6_ = 0;
1803 num_local_candidates_ipv4_ = 0; 1803 num_local_candidates_ipv4_ = 0;
1804 ice_connection_checking_start_ = base::TimeTicks(); 1804 ice_connection_checking_start_ = base::TimeTicks();
1805 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); 1805 memset(ice_state_seen_, 0, sizeof(ice_state_seen_));
1806 } 1806 }
1807 } // namespace content 1807 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_features.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698