2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-04-12 11:02:38 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2011-12-21 13:34:18 +00:00
|
|
|
#include <string>
|
2011-07-07 08:21:25 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
2012-06-12 07:16:24 +00:00
|
|
|
#include "gtest/gtest.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
#include "APITest.h"
|
2012-06-12 07:16:24 +00:00
|
|
|
#include "audio_coding_module.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
#include "EncodeDecodeTest.h"
|
|
|
|
|
#include "iSACTest.h"
|
|
|
|
|
#include "TestAllCodecs.h"
|
|
|
|
|
#include "TestFEC.h"
|
|
|
|
|
#include "TestStereo.h"
|
2012-06-12 07:16:24 +00:00
|
|
|
#include "testsupport/fileutils.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
#include "TestVADDTX.h"
|
2012-06-12 07:16:24 +00:00
|
|
|
#include "trace.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
#include "TwoWayCommunication.h"
|
|
|
|
|
|
2011-12-16 10:09:04 +00:00
|
|
|
using webrtc::AudioCodingModule;
|
|
|
|
|
using webrtc::Trace;
|
|
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
// Choose what tests to run by defining one or more of the following:
|
|
|
|
|
#define ACM_AUTO_TEST // Most common codecs and settings will be tested
|
|
|
|
|
//#define ACM_TEST_ENC_DEC // You decide what to test in run time.
|
|
|
|
|
// Used for debugging and for testing while implementing.
|
|
|
|
|
//#define ACM_TEST_TWO_WAY // Debugging
|
|
|
|
|
//#define ACM_TEST_ALL_ENC_DEC // Loop through all defined codecs and settings
|
|
|
|
|
//#define ACM_TEST_STEREO // Run stereo and spatial audio tests
|
|
|
|
|
//#define ACM_TEST_VAD_DTX // Run all VAD/DTX tests
|
|
|
|
|
//#define ACM_TEST_FEC // Test FEC (also called RED)
|
|
|
|
|
//#define ACM_TEST_CODEC_SPEC_API // Only iSAC has codec specfic APIs in this version
|
|
|
|
|
//#define ACM_TEST_FULL_API // Test all APIs with threads (long test)
|
|
|
|
|
|
2012-06-12 07:16:24 +00:00
|
|
|
void PopulateTests(std::vector<ACMTest*>* tests) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() + "acm_trace.txt").c_str());
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-06-12 07:16:24 +00:00
|
|
|
printf("The following tests will be executed:\n");
|
2011-07-07 08:21:25 +00:00
|
|
|
#ifdef ACM_AUTO_TEST
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM auto test\n");
|
|
|
|
|
tests->push_back(new webrtc::EncodeDecodeTest(0));
|
|
|
|
|
tests->push_back(new webrtc::TwoWayCommunication(0));
|
|
|
|
|
tests->push_back(new webrtc::TestAllCodecs(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));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_ENC_DEC
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM encode-decode test\n");
|
|
|
|
|
tests->push_back(new webrtc::EncodeDecodeTest(2));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_TWO_WAY
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM two-way communication test\n");
|
|
|
|
|
tests->push_back(new webrtc::TwoWayCommunication(1));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_ALL_ENC_DEC
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM all codecs test\n");
|
|
|
|
|
tests->push_back(new webrtc::TestAllCodecs(1));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_STEREO
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM stereo test\n");
|
|
|
|
|
tests->push_back(new webrtc::TestStereo(1));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_VAD_DTX
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM VAD-DTX test\n");
|
|
|
|
|
tests->push_back(new webrtc::TestVADDTX(1));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_FEC
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM FEC test\n");
|
|
|
|
|
tests->push_back(new webrtc::TestFEC(1));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_CODEC_SPEC_API
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM codec API test\n");
|
|
|
|
|
tests->push_back(new webrtc::ISACTest(1));
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef ACM_TEST_FULL_API
|
2012-06-12 07:16:24 +00:00
|
|
|
printf(" ACM full API test\n");
|
|
|
|
|
tests->push_back(new webrtc::APITest());
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
2012-06-12 07:16:24 +00:00
|
|
|
printf("\n");
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-12-21 13:34:18 +00:00
|
|
|
// TODO(kjellander): Make this a proper gtest instead of using this single test
|
|
|
|
|
// to run all the tests.
|
2012-06-12 07:16:24 +00:00
|
|
|
TEST(AudioCodingModuleTest, RunAllTests) {
|
|
|
|
|
std::vector<ACMTest*> tests;
|
|
|
|
|
PopulateTests(&tests);
|
|
|
|
|
std::vector<ACMTest*>::iterator it;
|
|
|
|
|
for (it = tests.begin(); it < tests.end(); it++) {
|
|
|
|
|
(*it)->Perform();
|
|
|
|
|
delete (*it);
|
|
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-06-12 07:16:24 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
printf("ACM test completed\n");
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|