diff options
author | henrike@webrtc.org <henrike@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-03-28 15:58:49 +0000 |
---|---|---|
committer | henrike@webrtc.org <henrike@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-03-28 15:58:49 +0000 |
commit | 3b6f72889e2ebac50ee5d21836b0b7ca2ba65d26 (patch) | |
tree | 021eaf0f182f6aadbb32789f72147cb5bfa9b99c /voice_engine | |
parent | fa2dd2236203bca19390976e39e4442270064504 (diff) | |
download | webrtc-3b6f72889e2ebac50ee5d21836b0b7ca2ba65d26.tar.gz |
Removed CPU APIs from VoEHardware. Code is now only used by test applications.
Recommitting https://code.google.com/p/webrtc/source/detail?r=3736 after fixing build break.
BUG=8404677
TBR=andrew@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1269004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3739 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine')
-rw-r--r-- | voice_engine/include/voe_hardware.h | 7 | ||||
-rw-r--r-- | voice_engine/test/auto_test/standard/hardware_before_streaming_test.cc | 11 | ||||
-rw-r--r-- | voice_engine/test/auto_test/standard/hardware_test.cc | 14 | ||||
-rw-r--r-- | voice_engine/voe_hardware_impl.cc | 55 | ||||
-rw-r--r-- | voice_engine/voe_hardware_impl.h | 4 |
5 files changed, 1 insertions, 90 deletions
diff --git a/voice_engine/include/voe_hardware.h b/voice_engine/include/voe_hardware.h index e973c110..1537aab6 100644 --- a/voice_engine/include/voe_hardware.h +++ b/voice_engine/include/voe_hardware.h @@ -93,13 +93,6 @@ public: // of total CPU availability. [Windows only] virtual int GetCPULoad(int& loadPercent) = 0; - // Gets the computer's current CPU consumption in terms of the percent - // of the total CPU availability. This method may fail a few times on - // Windows because it needs a certain warm-up time before reporting the - // result. You should check the return value and either try again or - // give up when it fails. - virtual int GetSystemCPULoad(int& loadPercent) = 0; - // Not supported virtual int ResetAudioDevice() = 0; diff --git a/voice_engine/test/auto_test/standard/hardware_before_streaming_test.cc b/voice_engine/test/auto_test/standard/hardware_before_streaming_test.cc index edb7f562..6136543b 100644 --- a/voice_engine/test/auto_test/standard/hardware_before_streaming_test.cc +++ b/voice_engine/test/auto_test/standard/hardware_before_streaming_test.cc @@ -51,17 +51,6 @@ TEST_F(HardwareBeforeStreamingTest, ResetsAudioDeviceOnIphone) { // Tests that only apply to desktop: #if !defined(WEBRTC_IOS) & !defined(WEBRTC_ANDROID) -TEST_F(HardwareBeforeStreamingTest, GetSystemCpuLoadSucceeds) { -#ifdef _WIN32 - // This method needs some warm-up time on Windows. We sleep a good amount - // of time instead of retrying to make the test simpler. - Sleep(2000); -#endif - - int load_percent; - EXPECT_EQ(0, voe_hardware_->GetSystemCPULoad(load_percent)); -} - TEST_F(HardwareBeforeStreamingTest, GetPlayoutDeviceStatusReturnsTrue) { bool play_available = false; EXPECT_EQ(0, voe_hardware_->GetPlayoutDeviceStatus(play_available)); diff --git a/voice_engine/test/auto_test/standard/hardware_test.cc b/voice_engine/test/auto_test/standard/hardware_test.cc index 7310e52d..d026f516 100644 --- a/voice_engine/test/auto_test/standard/hardware_test.cc +++ b/voice_engine/test/auto_test/standard/hardware_test.cc @@ -69,20 +69,6 @@ TEST_F(HardwareTest, GetCpuLoadReturnsErrorOnNonWindowsPlatform) { } #endif -#if !defined(WEBRTC_MAC) && !defined(WEBRTC_ANDROID) -TEST_F(HardwareTest, GetSystemCpuLoadWorksExceptOnMacAndAndroid) { -#ifdef _WIN32 - // This method needs some warm-up time on Windows. We sleep a good amount - // of time instead of retrying to make the test simpler. - Sleep(2000); -#endif - int load = -1; - EXPECT_EQ(0, voe_hardware_->GetSystemCPULoad(load)); - EXPECT_GE(load, 0); - TEST_LOG("System CPU load = %d%%\n", load); -} -#endif - TEST_F(HardwareTest, BuiltInWasapiAECWorksForAudioWindowsCoreAudioLayer) { #ifdef WEBRTC_IOS // Ensure the sound device is reset on iPhone. diff --git a/voice_engine/voe_hardware_impl.cc b/voice_engine/voe_hardware_impl.cc index db7e18fa..a374bc9a 100644 --- a/voice_engine/voe_hardware_impl.cc +++ b/voice_engine/voe_hardware_impl.cc @@ -12,7 +12,6 @@ #include <cassert> -#include "cpu_wrapper.h" #include "critical_section_wrapper.h" #include "trace.h" #include "voe_errors.h" @@ -38,29 +37,16 @@ VoEHardware* VoEHardware::GetInterface(VoiceEngine* voiceEngine) #ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API -VoEHardwareImpl::VoEHardwareImpl(voe::SharedData* shared) : - _cpu(NULL), _shared(shared) +VoEHardwareImpl::VoEHardwareImpl(voe::SharedData* shared) : _shared(shared) { WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), "VoEHardwareImpl() - ctor"); - - _cpu = CpuWrapper::CreateCpu(); - if (_cpu) - { - _cpu->CpuUsage(); // init cpu usage - } } VoEHardwareImpl::~VoEHardwareImpl() { WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), "~VoEHardwareImpl() - dtor"); - - if (_cpu) - { - delete _cpu; - _cpu = NULL; - } } int VoEHardwareImpl::SetAudioDeviceLayer(AudioLayers audioLayer) @@ -753,45 +739,6 @@ int VoEHardwareImpl::GetCPULoad(int& loadPercent) return 0; } -int VoEHardwareImpl::GetSystemCPULoad(int& loadPercent) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "GetSystemCPULoad(loadPercent=?)"); - ANDROID_NOT_SUPPORTED(_shared->statistics()); - IPHONE_NOT_SUPPORTED(_shared->statistics()); - - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - - // Check if implemented for this platform - if (!_cpu) - { - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - " no support for getting system CPU load"); - return -1; - } - - // Get CPU load - WebRtc_Word32 load = _cpu->CpuUsage(); - if (load < 0) - { - _shared->SetLastError(VE_CPU_INFO_ERROR, kTraceError, - " error getting system CPU load"); - return -1; - } - - loadPercent = static_cast<int> (load); - - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, - VoEId(_shared->instance_id(), -1), - " Output: loadPercent = %d", loadPercent); - - return 0; -} - int VoEHardwareImpl::EnableBuiltInAEC(bool enable) { WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), diff --git a/voice_engine/voe_hardware_impl.h b/voice_engine/voe_hardware_impl.h index 94775672..1b2f3434 100644 --- a/voice_engine/voe_hardware_impl.h +++ b/voice_engine/voe_hardware_impl.h @@ -17,7 +17,6 @@ namespace webrtc { -class CpuWrapper; class VoEHardwareImpl: public VoEHardware { @@ -50,8 +49,6 @@ public: virtual int GetCPULoad(int& loadPercent); - virtual int GetSystemCPULoad(int& loadPercent); - virtual int ResetAudioDevice(); virtual int AudioDeviceControl(unsigned int par1, @@ -75,7 +72,6 @@ protected: virtual ~VoEHardwareImpl(); private: - CpuWrapper* _cpu; voe::SharedData* _shared; }; |