| 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 OverrideDefaultCertificate( | |
| 726 webrtc::PeerConnectionInterface::RTCConfiguration* config) { | |
| 727 if (rtc::KT_DEFAULT != rtc::KT_ECDSA && config->certificates.empty()) { | |
| 728 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | |
| 729 PeerConnectionDependencyFactory::GenerateDefaultCertificate(); | |
| 730 config->certificates.push_back(certificate); | |
| 731 } | |
| 732 } | |
| 733 | |
| 734 } // namespace | 725 } // namespace |
| 735 | 726 |
| 736 // Implementation of LocalRTCStatsRequest. | 727 // Implementation of LocalRTCStatsRequest. |
| 737 LocalRTCStatsRequest::LocalRTCStatsRequest(blink::WebRTCStatsRequest impl) | 728 LocalRTCStatsRequest::LocalRTCStatsRequest(blink::WebRTCStatsRequest impl) |
| 738 : impl_(impl) { | 729 : impl_(impl) { |
| 739 } | 730 } |
| 740 | 731 |
| 741 LocalRTCStatsRequest::LocalRTCStatsRequest() {} | 732 LocalRTCStatsRequest::LocalRTCStatsRequest() {} |
| 742 LocalRTCStatsRequest::~LocalRTCStatsRequest() {} | 733 LocalRTCStatsRequest::~LocalRTCStatsRequest() {} |
| 743 | 734 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 const blink::WebRTCConfiguration& server_configuration, | 945 const blink::WebRTCConfiguration& server_configuration, |
| 955 const blink::WebMediaConstraints& options) { | 946 const blink::WebMediaConstraints& options) { |
| 956 DCHECK(thread_checker_.CalledOnValidThread()); | 947 DCHECK(thread_checker_.CalledOnValidThread()); |
| 957 DCHECK(frame_); | 948 DCHECK(frame_); |
| 958 | 949 |
| 959 peer_connection_tracker_ = | 950 peer_connection_tracker_ = |
| 960 RenderThreadImpl::current()->peer_connection_tracker()->AsWeakPtr(); | 951 RenderThreadImpl::current()->peer_connection_tracker()->AsWeakPtr(); |
| 961 | 952 |
| 962 webrtc::PeerConnectionInterface::RTCConfiguration config; | 953 webrtc::PeerConnectionInterface::RTCConfiguration config; |
| 963 GetNativeRtcConfiguration(server_configuration, &config); | 954 GetNativeRtcConfiguration(server_configuration, &config); |
| 964 OverrideDefaultCertificate(&config); | |
| 965 | 955 |
| 966 // Choose between RTC smoothness algorithm and prerenderer smoothing. | 956 // Choose between RTC smoothness algorithm and prerenderer smoothing. |
| 967 // Prerenderer smoothing is turned on if RTC smoothness is turned off. | 957 // Prerenderer smoothing is turned on if RTC smoothness is turned off. |
| 968 config.set_prerenderer_smoothing( | 958 config.set_prerenderer_smoothing( |
| 969 base::CommandLine::ForCurrentProcess()->HasSwitch( | 959 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 970 switches::kDisableRTCSmoothnessAlgorithm)); | 960 switches::kDisableRTCSmoothnessAlgorithm)); |
| 971 | 961 |
| 972 // Copy all the relevant constraints into |config|. | 962 // Copy all the relevant constraints into |config|. |
| 973 CopyConstraintsIntoRtcConfiguration(options, &config); | 963 CopyConstraintsIntoRtcConfiguration(options, &config); |
| 974 | 964 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 991 return true; | 981 return true; |
| 992 } | 982 } |
| 993 | 983 |
| 994 bool RTCPeerConnectionHandler::InitializeForTest( | 984 bool RTCPeerConnectionHandler::InitializeForTest( |
| 995 const blink::WebRTCConfiguration& server_configuration, | 985 const blink::WebRTCConfiguration& server_configuration, |
| 996 const blink::WebMediaConstraints& options, | 986 const blink::WebMediaConstraints& options, |
| 997 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker) { | 987 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker) { |
| 998 DCHECK(thread_checker_.CalledOnValidThread()); | 988 DCHECK(thread_checker_.CalledOnValidThread()); |
| 999 webrtc::PeerConnectionInterface::RTCConfiguration config; | 989 webrtc::PeerConnectionInterface::RTCConfiguration config; |
| 1000 GetNativeRtcConfiguration(server_configuration, &config); | 990 GetNativeRtcConfiguration(server_configuration, &config); |
| 1001 OverrideDefaultCertificate(&config); | |
| 1002 | 991 |
| 1003 peer_connection_observer_ = new Observer(weak_factory_.GetWeakPtr()); | 992 peer_connection_observer_ = new Observer(weak_factory_.GetWeakPtr()); |
| 1004 CopyConstraintsIntoRtcConfiguration(options, &config); | 993 CopyConstraintsIntoRtcConfiguration(options, &config); |
| 1005 | 994 |
| 1006 native_peer_connection_ = dependency_factory_->CreatePeerConnection( | 995 native_peer_connection_ = dependency_factory_->CreatePeerConnection( |
| 1007 config, nullptr, peer_connection_observer_.get()); | 996 config, nullptr, peer_connection_observer_.get()); |
| 1008 if (!native_peer_connection_.get()) { | 997 if (!native_peer_connection_.get()) { |
| 1009 LOG(ERROR) << "Failed to initialize native PeerConnection."; | 998 LOG(ERROR) << "Failed to initialize native PeerConnection."; |
| 1010 return false; | 999 return false; |
| 1011 } | 1000 } |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 } | 1782 } |
| 1794 | 1783 |
| 1795 void RTCPeerConnectionHandler::ResetUMAStats() { | 1784 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1796 DCHECK(thread_checker_.CalledOnValidThread()); | 1785 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1797 num_local_candidates_ipv6_ = 0; | 1786 num_local_candidates_ipv6_ = 0; |
| 1798 num_local_candidates_ipv4_ = 0; | 1787 num_local_candidates_ipv4_ = 0; |
| 1799 ice_connection_checking_start_ = base::TimeTicks(); | 1788 ice_connection_checking_start_ = base::TimeTicks(); |
| 1800 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1789 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1801 } | 1790 } |
| 1802 } // namespace content | 1791 } // namespace content |
| OLD | NEW |