Re-organizing ACM tests
The ACM tests needed re-writing, because all tests were not individual gtests, and the result was difficult to interpret. While doing the re-write, I discovered a bug related to 48 kHz CNG. We can't have the 48 kHz CNG active at the moment. The bug is fixed in this CL. I also needed to rewrite parts of the VAD/DTX implementation, so that the status of VAD and DTX (enabled or not) is propagated back from the function SetVAD(). BUG=issue2173 R=minyue@webrtc.org, turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1961004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4625 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -31,95 +31,9 @@ using webrtc::AudioCodingModule;
|
||||
using webrtc::Trace;
|
||||
|
||||
// This parameter is used to describe how to run the tests. It is normally
|
||||
// set to 1, but in auto test all printing is turned off, and the parameter is
|
||||
// set to 0.
|
||||
#define ACM_TEST_MODE 1
|
||||
|
||||
// TODO(tlegrand): Add all tests as individual gtests, like already done for
|
||||
// TestAllCodecs (ACM_TEST_ALL_ENC_DEC).
|
||||
|
||||
// Choose what tests to run by defining one or more of the following:
|
||||
//
|
||||
// ACM_AUTO_TEST - Most common codecs and settings will be tested. All the
|
||||
// other tests will be activated.
|
||||
// ACM_TEST_ENC_DEC - You decide what to test in run time. Used for debugging
|
||||
// and for testing while implementing.
|
||||
// ACM_TEST_TWO_WAY - Mainly for debugging.
|
||||
// ACM_TEST_ALL_CODECS - Loop through all defined codecs and settings.
|
||||
// ACM_TEST_STEREO - Run stereo and spatial audio tests.
|
||||
// ACM_TEST_VAD_DTX - Run all VAD/DTX tests.
|
||||
// ACM_TEST_FEC - Test FEC (also called RED).
|
||||
// ACM_TEST_CODEC_SPEC_API - Test the iSAC has codec specfic APIs.
|
||||
// ACM_TEST_FULL_API - Test all APIs with threads (long test).
|
||||
|
||||
#define ACM_AUTO_TEST
|
||||
//#define ACM_TEST_ENC_DEC
|
||||
//#define ACM_TEST_TWO_WAY
|
||||
//#define ACM_TEST_ALL_CODECS
|
||||
//#define ACM_TEST_STEREO
|
||||
//#define ACM_TEST_VAD_DTX
|
||||
//#define ACM_TEST_FEC
|
||||
//#define ACM_TEST_CODEC_SPEC_API
|
||||
//#define ACM_TEST_FULL_API
|
||||
|
||||
// If Auto test is active, we activate all tests.
|
||||
#ifdef ACM_AUTO_TEST
|
||||
#undef ACM_TEST_MODE
|
||||
// set to 0, and all tests are run in quite mode.
|
||||
#define ACM_TEST_MODE 0
|
||||
#ifndef ACM_TEST_ALL_CODECS
|
||||
#define ACM_TEST_ALL_CODECS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void PopulateTests(std::vector<ACMTest*>* tests) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() + "acm_trace.txt").c_str());
|
||||
|
||||
printf("The following tests will be executed:\n");
|
||||
#ifdef ACM_AUTO_TEST
|
||||
printf(" ACM auto test\n");
|
||||
tests->push_back(new webrtc::EncodeDecodeTest(0));
|
||||
tests->push_back(new webrtc::TwoWayCommunication(0));
|
||||
tests->push_back(new webrtc::TestStereo(0));
|
||||
tests->push_back(new webrtc::TestVADDTX(0));
|
||||
tests->push_back(new webrtc::TestFEC(0));
|
||||
tests->push_back(new webrtc::ISACTest(0));
|
||||
#endif
|
||||
#ifdef ACM_TEST_ENC_DEC
|
||||
printf(" ACM encode-decode test\n");
|
||||
tests->push_back(new webrtc::EncodeDecodeTest(2));
|
||||
#endif
|
||||
#ifdef ACM_TEST_TWO_WAY
|
||||
printf(" ACM two-way communication test\n");
|
||||
tests->push_back(new webrtc::TwoWayCommunication(1));
|
||||
#endif
|
||||
#ifdef ACM_TEST_STEREO
|
||||
printf(" ACM stereo test\n");
|
||||
tests->push_back(new webrtc::TestStereo(1));
|
||||
#endif
|
||||
#ifdef ACM_TEST_VAD_DTX
|
||||
printf(" ACM VAD-DTX test\n");
|
||||
tests->push_back(new webrtc::TestVADDTX(1));
|
||||
#endif
|
||||
#ifdef ACM_TEST_FEC
|
||||
printf(" ACM FEC test\n");
|
||||
tests->push_back(new webrtc::TestFEC(1));
|
||||
#endif
|
||||
#ifdef ACM_TEST_CODEC_SPEC_API
|
||||
printf(" ACM codec API test\n");
|
||||
tests->push_back(new webrtc::ISACTest(1));
|
||||
#endif
|
||||
#ifdef ACM_TEST_FULL_API
|
||||
printf(" ACM full API test\n");
|
||||
tests->push_back(new webrtc::APITest());
|
||||
#endif
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// TODO(kjellander): Make this a proper gtest instead of using this single test
|
||||
// to run all the tests.
|
||||
|
||||
#ifdef ACM_TEST_ALL_CODECS
|
||||
TEST(AudioCodingModuleTest, TestAllCodecs) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
@ -127,25 +41,71 @@ TEST(AudioCodingModuleTest, TestAllCodecs) {
|
||||
webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_encodedecode_trace.txt").c_str());
|
||||
webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestFEC)) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_fec_trace.txt").c_str());
|
||||
webrtc::TestFEC().Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestIsac)) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_isac_trace.txt").c_str());
|
||||
webrtc::ISACTest(ACM_TEST_MODE).Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TwoWayCommunication)) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_twowaycom_trace.txt").c_str());
|
||||
webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestStereo)) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_stereo_trace.txt").c_str());
|
||||
webrtc::TestStereo(ACM_TEST_MODE).Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestVADDTX)) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_vaddtx_trace.txt").c_str());
|
||||
webrtc::TestVADDTX().Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, TestOpus) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_opus_trace.txt").c_str());
|
||||
"acm_opus_trace.txt").c_str());
|
||||
webrtc::OpusTest().Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(RunAllTests)) {
|
||||
std::vector<ACMTest*> tests;
|
||||
PopulateTests(&tests);
|
||||
std::vector<ACMTest*>::iterator it;
|
||||
for (it = tests.begin(); it < tests.end(); it++) {
|
||||
(*it)->Perform();
|
||||
delete (*it);
|
||||
// The full API test is too long to run automatically on bots, but can be used
|
||||
// for offline testing. User interaction is needed.
|
||||
#ifdef ACM_TEST_FULL_API
|
||||
TEST(AudioCodingModuleTest, TestAPI) {
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
||||
"acm_apitest_trace.txt").c_str());
|
||||
webrtc::APITest().Perform();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
Trace::ReturnTrace();
|
||||
printf("ACM test completed\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user