Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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( | 725 void OverrideDefaultCertificate( |
| 726 webrtc::PeerConnectionInterface::RTCConfiguration* config) { | 726 webrtc::PeerConnectionInterface::RTCConfiguration* config) { |
| 727 if (base::FeatureList::IsEnabled(features::kWebRtcEcdsaDefault)) { | 727 if (rtc::KT_DEFAULT != rtc::KT_ECDSA && config->certificates.empty()) { |
|
tommi (sloooow) - chröme
2016/05/24 20:58:11
do we still need this or do you plan on removing t
hbos_chromium
2016/05/25 07:58:34
Since this CL removes a static_assert about KT_DEF
| |
| 728 if (config->certificates.empty()) { | 728 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
| 729 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 729 PeerConnectionDependencyFactory::GenerateDefaultCertificate(); |
| 730 PeerConnectionDependencyFactory::GenerateDefaultCertificate(); | 730 config->certificates.push_back(certificate); |
| 731 config->certificates.push_back(certificate); | |
| 732 } | |
| 733 } | 731 } |
| 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 static_assert(rtc::KT_DEFAULT == rtc::KT_RSA, "This code relies on " | |
| 737 "KT_DEFAULT == KT_RSA for RSA certificate generation."); | |
| 738 } | 732 } |
| 739 | 733 |
| 740 } // namespace | 734 } // namespace |
| 741 | 735 |
| 742 // Implementation of LocalRTCStatsRequest. | 736 // Implementation of LocalRTCStatsRequest. |
| 743 LocalRTCStatsRequest::LocalRTCStatsRequest(blink::WebRTCStatsRequest impl) | 737 LocalRTCStatsRequest::LocalRTCStatsRequest(blink::WebRTCStatsRequest impl) |
| 744 : impl_(impl) { | 738 : impl_(impl) { |
| 745 } | 739 } |
| 746 | 740 |
| 747 LocalRTCStatsRequest::LocalRTCStatsRequest() {} | 741 LocalRTCStatsRequest::LocalRTCStatsRequest() {} |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 const blink::WebRTCConfiguration& server_configuration, | 954 const blink::WebRTCConfiguration& server_configuration, |
| 961 const blink::WebMediaConstraints& options) { | 955 const blink::WebMediaConstraints& options) { |
| 962 DCHECK(thread_checker_.CalledOnValidThread()); | 956 DCHECK(thread_checker_.CalledOnValidThread()); |
| 963 DCHECK(frame_); | 957 DCHECK(frame_); |
| 964 | 958 |
| 965 peer_connection_tracker_ = | 959 peer_connection_tracker_ = |
| 966 RenderThreadImpl::current()->peer_connection_tracker()->AsWeakPtr(); | 960 RenderThreadImpl::current()->peer_connection_tracker()->AsWeakPtr(); |
| 967 | 961 |
| 968 webrtc::PeerConnectionInterface::RTCConfiguration config; | 962 webrtc::PeerConnectionInterface::RTCConfiguration config; |
| 969 GetNativeRtcConfiguration(server_configuration, &config); | 963 GetNativeRtcConfiguration(server_configuration, &config); |
| 970 OverrideDefaultCertificateBasedOnExperiment(&config); | 964 OverrideDefaultCertificate(&config); |
| 971 | 965 |
| 972 // Choose between RTC smoothness algorithm and prerenderer smoothing. | 966 // Choose between RTC smoothness algorithm and prerenderer smoothing. |
| 973 // Prerenderer smoothing is turned on if RTC smoothness is turned off. | 967 // Prerenderer smoothing is turned on if RTC smoothness is turned off. |
| 974 config.set_prerenderer_smoothing( | 968 config.set_prerenderer_smoothing( |
| 975 base::CommandLine::ForCurrentProcess()->HasSwitch( | 969 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 976 switches::kDisableRTCSmoothnessAlgorithm)); | 970 switches::kDisableRTCSmoothnessAlgorithm)); |
| 977 | 971 |
| 978 // Copy all the relevant constraints into |config|. | 972 // Copy all the relevant constraints into |config|. |
| 979 CopyConstraintsIntoRtcConfiguration(options, &config); | 973 CopyConstraintsIntoRtcConfiguration(options, &config); |
| 980 | 974 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 997 return true; | 991 return true; |
| 998 } | 992 } |
| 999 | 993 |
| 1000 bool RTCPeerConnectionHandler::InitializeForTest( | 994 bool RTCPeerConnectionHandler::InitializeForTest( |
| 1001 const blink::WebRTCConfiguration& server_configuration, | 995 const blink::WebRTCConfiguration& server_configuration, |
| 1002 const blink::WebMediaConstraints& options, | 996 const blink::WebMediaConstraints& options, |
| 1003 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker) { | 997 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker) { |
| 1004 DCHECK(thread_checker_.CalledOnValidThread()); | 998 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1005 webrtc::PeerConnectionInterface::RTCConfiguration config; | 999 webrtc::PeerConnectionInterface::RTCConfiguration config; |
| 1006 GetNativeRtcConfiguration(server_configuration, &config); | 1000 GetNativeRtcConfiguration(server_configuration, &config); |
| 1007 OverrideDefaultCertificateBasedOnExperiment(&config); | 1001 OverrideDefaultCertificate(&config); |
| 1008 | 1002 |
| 1009 peer_connection_observer_ = new Observer(weak_factory_.GetWeakPtr()); | 1003 peer_connection_observer_ = new Observer(weak_factory_.GetWeakPtr()); |
| 1010 CopyConstraintsIntoRtcConfiguration(options, &config); | 1004 CopyConstraintsIntoRtcConfiguration(options, &config); |
| 1011 | 1005 |
| 1012 native_peer_connection_ = dependency_factory_->CreatePeerConnection( | 1006 native_peer_connection_ = dependency_factory_->CreatePeerConnection( |
| 1013 config, nullptr, peer_connection_observer_.get()); | 1007 config, nullptr, peer_connection_observer_.get()); |
| 1014 if (!native_peer_connection_.get()) { | 1008 if (!native_peer_connection_.get()) { |
| 1015 LOG(ERROR) << "Failed to initialize native PeerConnection."; | 1009 LOG(ERROR) << "Failed to initialize native PeerConnection."; |
| 1016 return false; | 1010 return false; |
| 1017 } | 1011 } |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1799 } | 1793 } |
| 1800 | 1794 |
| 1801 void RTCPeerConnectionHandler::ResetUMAStats() { | 1795 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1802 DCHECK(thread_checker_.CalledOnValidThread()); | 1796 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1803 num_local_candidates_ipv6_ = 0; | 1797 num_local_candidates_ipv6_ = 0; |
| 1804 num_local_candidates_ipv4_ = 0; | 1798 num_local_candidates_ipv4_ = 0; |
| 1805 ice_connection_checking_start_ = base::TimeTicks(); | 1799 ice_connection_checking_start_ = base::TimeTicks(); |
| 1806 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1800 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1807 } | 1801 } |
| 1808 } // namespace content | 1802 } // namespace content |
| OLD | NEW |