From cc92e000f383ed57777317c3af5e29d142b9aa2e Mon Sep 17 00:00:00 2001 From: "minyue@webrtc.org" Date: Mon, 30 Sep 2013 08:43:50 +0000 Subject: [PATCH] 1. adding request of ACM version in the manual mode of voe_auto_test 2. adding command line flag for automated mode of voe_auto_test to choose between ACMs 3. adding request of ACM version in voe_cmd_test R=phoglund@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2281004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4877 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../fixtures/before_initialization_fixture.cc | 13 +++++++++++-- .../fixtures/before_initialization_fixture.h | 2 ++ .../test/auto_test/voe_standard_test.cc | 17 ++++++++++++----- .../test/auto_test/voe_standard_test.h | 3 +++ .../test/cmd_test/voe_cmd_test.cc | 19 +++++++++++++++++-- webrtc/voice_engine/voice_engine.gyp | 1 + 6 files changed, 46 insertions(+), 9 deletions(-) diff --git a/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc b/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc index ea37e39569..9dd0b0f77a 100644 --- a/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc +++ b/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc @@ -10,10 +10,19 @@ #include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h" +#include "gflags/gflags.h" +#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" #include "webrtc/system_wrappers/interface/sleep.h" -BeforeInitializationFixture::BeforeInitializationFixture() - : voice_engine_(webrtc::VoiceEngine::Create()) { +DECLARE_bool(use_acm_version_2); + +BeforeInitializationFixture::BeforeInitializationFixture() { + // TODO(minyue): Remove when the old ACM is removed (latest 2014-04-01). + config_.Set(FLAGS_use_acm_version_2 ? + new webrtc::NewAudioCodingModuleFactory() : + new webrtc::AudioCodingModuleFactory()); + voice_engine_ = webrtc::VoiceEngine::Create(config_); + EXPECT_TRUE(voice_engine_ != NULL); voe_base_ = webrtc::VoEBase::GetInterface(voice_engine_); diff --git a/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h b/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h index c1b0f38c61..5b85c3e2e8 100644 --- a/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h +++ b/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h @@ -13,6 +13,7 @@ #include +#include "webrtc/common.h" #include "webrtc/common_types.h" #include "webrtc/engine_configurations.h" #include "webrtc/test/testsupport/gtest_disable.h" @@ -71,6 +72,7 @@ class BeforeInitializationFixture : public testing::Test { webrtc::VoEExternalMedia* voe_xmedia_; webrtc::VoECallReport* voe_call_report_; webrtc::VoENetEqStats* voe_neteq_stats_; + webrtc::Config config_; }; #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_ diff --git a/webrtc/voice_engine/test/auto_test/voe_standard_test.cc b/webrtc/voice_engine/test/auto_test/voe_standard_test.cc index fed756d9e7..05eb4d6820 100644 --- a/webrtc/voice_engine/test/auto_test/voe_standard_test.cc +++ b/webrtc/voice_engine/test/auto_test/voe_standard_test.cc @@ -14,6 +14,7 @@ #include #include "webrtc/engine_configurations.h" +#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" #include "webrtc/system_wrappers/interface/event_wrapper.h" #include "webrtc/voice_engine/include/voe_neteq_stats.h" #include "webrtc/voice_engine/test/auto_test/automated_mode.h" @@ -30,6 +31,8 @@ DEFINE_bool(include_timing_dependent_tests, true, DEFINE_bool(automated, false, "If true, we'll run the automated tests we have in noninteractive " "mode."); +DEFINE_bool(use_acm_version_2, false, + "If true, we'll run the tests with Audio Coding Module version 2."); using namespace webrtc; @@ -263,8 +266,7 @@ VoETestManager::VoETestManager() voe_rtp_rtcp_(0), voe_vsync_(0), voe_volume_control_(0), - voe_apm_(0) -{ + voe_apm_(0) { } VoETestManager::~VoETestManager() { @@ -282,7 +284,12 @@ bool VoETestManager::Init() { return false; } - voice_engine_ = VoiceEngine::Create(); + // TODO(minyue): Remove when the old ACM is removed (latest 2014-04-01). + config_.Set(FLAGS_use_acm_version_2 ? + new NewAudioCodingModuleFactory() : + new AudioCodingModuleFactory()); + voice_engine_ = VoiceEngine::Create(config_); + if (!voice_engine_) { TEST_LOG("Failed to create VoiceEngine\n"); return false; @@ -409,7 +416,8 @@ int VoETestManager::ReleaseInterfaces() { return (releaseOK == true) ? 0 : -1; } -int run_auto_test(TestType test_type, ExtendedSelection ext_selection) { +int run_auto_test(TestType test_type, + ExtendedSelection ext_selection) { assert(test_type != Standard); SubAPIManager api_manager; @@ -543,7 +551,6 @@ int RunInManualMode() { printf("\n: "); int selection(0); - dummy = scanf("%d", &selection); ExtendedSelection ext_selection = XSEL_Invalid; diff --git a/webrtc/voice_engine/test/auto_test/voe_standard_test.h b/webrtc/voice_engine/test/auto_test/voe_standard_test.h index 0710ce6506..1f68f6b983 100644 --- a/webrtc/voice_engine/test/auto_test/voe_standard_test.h +++ b/webrtc/voice_engine/test/auto_test/voe_standard_test.h @@ -15,6 +15,7 @@ #include #include "gflags/gflags.h" +#include "webrtc/common.h" #include "webrtc/voice_engine/include/voe_audio_processing.h" #include "webrtc/voice_engine/include/voe_base.h" #include "webrtc/voice_engine/include/voe_dtmf.h" @@ -227,6 +228,8 @@ class VoETestManager { VoEAudioProcessing* voe_apm_; ResourceManager resource_manager_; + + Config config_; }; } // namespace voetest diff --git a/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc b/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc index 7a6e512b5e..10fc198cde 100644 --- a/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc +++ b/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc @@ -17,8 +17,12 @@ #include +#include "gflags/gflags.h" #include "testing/gtest/include/gtest/gtest.h" +#include "webrtc/common.h" +#include "webrtc/common_types.h" #include "webrtc/engine_configurations.h" +#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/test/channel_transport/include/channel_transport.h" #include "webrtc/test/testsupport/fileutils.h" @@ -37,6 +41,9 @@ #include "webrtc/voice_engine/include/voe_video_sync.h" #include "webrtc/voice_engine/include/voe_volume_control.h" +DEFINE_bool(use_acm_version_2, false, + "If true, we'll run the tests with Audio Coding Module version 2."); + using namespace webrtc; using namespace test; @@ -111,12 +118,20 @@ void PrintCodecs(bool opus_stereo) { } } -int main() { +int main(int argc, char** argv) { + google::ParseCommandLineFlags(&argc, &argv, true); + int res = 0; printf("Test started \n"); - m_voe = VoiceEngine::Create(); + // TODO(minyue): Remove when the old ACM is removed (latest 2014-04-01). + Config config; + config.Set(FLAGS_use_acm_version_2 ? + new NewAudioCodingModuleFactory() : + new AudioCodingModuleFactory()); + m_voe = VoiceEngine::Create(config); + base1 = VoEBase::GetInterface(m_voe); codec = VoECodec::GetInterface(m_voe); apm = VoEAudioProcessing::GetInterface(m_voe); diff --git a/webrtc/voice_engine/voice_engine.gyp b/webrtc/voice_engine/voice_engine.gyp index e099ff9ac4..34070fabdf 100644 --- a/webrtc/voice_engine/voice_engine.gyp +++ b/webrtc/voice_engine/voice_engine.gyp @@ -227,6 +227,7 @@ 'dependencies': [ 'voice_engine', '<(DEPTH)/testing/gtest.gyp:gtest', + '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(webrtc_root)/test/test.gyp:channel_transport', '<(webrtc_root)/test/test.gyp:test_support',