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/webrtc@4877 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc b/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc
index ea37e39..9dd0b0f 100644
--- a/voice_engine/test/auto_test/fixtures/before_initialization_fixture.cc
+++ b/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<webrtc::AudioCodingModuleFactory>(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/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h b/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h
index c1b0f38..5b85c3e 100644
--- a/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h
+++ b/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h
@@ -13,6 +13,7 @@
#include <assert.h>
+#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 @@
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/voice_engine/test/auto_test/voe_standard_test.cc b/voice_engine/test/auto_test/voe_standard_test.cc
index fed756d..05eb4d6 100644
--- a/voice_engine/test/auto_test/voe_standard_test.cc
+++ b/voice_engine/test/auto_test/voe_standard_test.cc
@@ -14,6 +14,7 @@
#include <string.h>
#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(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 @@
voe_rtp_rtcp_(0),
voe_vsync_(0),
voe_volume_control_(0),
- voe_apm_(0)
-{
+ voe_apm_(0) {
}
VoETestManager::~VoETestManager() {
@@ -282,7 +284,12 @@
return false;
}
- voice_engine_ = VoiceEngine::Create();
+ // TODO(minyue): Remove when the old ACM is removed (latest 2014-04-01).
+ config_.Set<AudioCodingModuleFactory>(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 @@
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 @@
printf("\n: ");
int selection(0);
-
dummy = scanf("%d", &selection);
ExtendedSelection ext_selection = XSEL_Invalid;
diff --git a/voice_engine/test/auto_test/voe_standard_test.h b/voice_engine/test/auto_test/voe_standard_test.h
index 0710ce6..1f68f6b 100644
--- a/voice_engine/test/auto_test/voe_standard_test.h
+++ b/voice_engine/test/auto_test/voe_standard_test.h
@@ -15,6 +15,7 @@
#include <string>
#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 @@
VoEAudioProcessing* voe_apm_;
ResourceManager resource_manager_;
+
+ Config config_;
};
} // namespace voetest
diff --git a/voice_engine/test/cmd_test/voe_cmd_test.cc b/voice_engine/test/cmd_test/voe_cmd_test.cc
index 7a6e512..10fc198 100644
--- a/voice_engine/test/cmd_test/voe_cmd_test.cc
+++ b/voice_engine/test/cmd_test/voe_cmd_test.cc
@@ -17,8 +17,12 @@
#include <vector>
+#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 @@
}
}
-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<AudioCodingModuleFactory>(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/voice_engine/voice_engine.gyp b/voice_engine/voice_engine.gyp
index e099ff9..34070fa 100644
--- a/voice_engine/voice_engine.gyp
+++ b/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',