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>
|
|
|
|
|
|
2016-09-28 17:42:01 -07:00
|
|
|
#include "webrtc/test/gtest.h"
|
2015-11-26 04:44:54 -08:00
|
|
|
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/APITest.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/iSACTest.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/opus_test.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/PacketLossTest.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/TestAllCodecs.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/TestRedFec.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/TestStereo.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/TestVADDTX.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/TwoWayCommunication.h"
|
2015-10-28 18:17:40 +01:00
|
|
|
#include "webrtc/system_wrappers/include/trace.h"
|
2013-03-15 13:29:17 +00:00
|
|
|
#include "webrtc/test/testsupport/fileutils.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-12-16 10:09:04 +00:00
|
|
|
using webrtc::Trace;
|
|
|
|
|
|
2012-06-18 13:35:52 +00:00
|
|
|
// This parameter is used to describe how to run the tests. It is normally
|
2013-08-27 07:33:51 +00:00
|
|
|
// set to 0, and all tests are run in quite mode.
|
|
|
|
|
#define ACM_TEST_MODE 0
|
2012-06-18 13:35:52 +00:00
|
|
|
|
2013-08-27 07:33:51 +00:00
|
|
|
TEST(AudioCodingModuleTest, TestAllCodecs) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_allcodecs_trace.txt").c_str());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
2012-06-18 13:35:52 +00:00
|
|
|
|
2016-01-04 22:44:05 +01:00
|
|
|
#if defined(WEBRTC_ANDROID)
|
|
|
|
|
TEST(AudioCodingModuleTest, DISABLED_TestEncodeDecode) {
|
|
|
|
|
#else
|
|
|
|
|
TEST(AudioCodingModuleTest, TestEncodeDecode) {
|
|
|
|
|
#endif
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_encodedecode_trace.txt").c_str());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
2012-06-18 13:35:52 +00:00
|
|
|
|
2016-01-04 22:44:05 +01:00
|
|
|
#if defined(WEBRTC_CODEC_RED)
|
|
|
|
|
#if defined(WEBRTC_ANDROID)
|
|
|
|
|
TEST(AudioCodingModuleTest, DISABLED_TestRedFec) {
|
2015-09-30 21:54:21 -07:00
|
|
|
#else
|
2016-01-04 22:44:05 +01:00
|
|
|
TEST(AudioCodingModuleTest, TestRedFec) {
|
2015-09-30 21:54:21 -07:00
|
|
|
#endif
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_fec_trace.txt").c_str());
|
2014-05-23 15:16:51 +00:00
|
|
|
webrtc::TestRedFec().Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
2016-01-04 22:44:05 +01:00
|
|
|
#endif
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-30 21:54:21 -07:00
|
|
|
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
|
2016-01-04 22:44:05 +01:00
|
|
|
#if defined(WEBRTC_ANDROID)
|
|
|
|
|
TEST(AudioCodingModuleTest, DISABLED_TestIsac) {
|
2015-09-30 21:54:21 -07:00
|
|
|
#else
|
2016-01-04 22:44:05 +01:00
|
|
|
TEST(AudioCodingModuleTest, TestIsac) {
|
2015-09-30 21:54:21 -07:00
|
|
|
#endif
|
2012-06-12 07:16:24 +00:00
|
|
|
Trace::CreateTrace();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_isac_trace.txt").c_str());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::ISACTest(ACM_TEST_MODE).Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
2016-01-04 22:44:05 +01:00
|
|
|
#endif
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-30 21:54:21 -07:00
|
|
|
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
|
|
|
|
|
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
|
2016-01-04 22:44:05 +01:00
|
|
|
#if defined(WEBRTC_ANDROID)
|
|
|
|
|
TEST(AudioCodingModuleTest, DISABLED_TwoWayCommunication) {
|
2015-09-30 21:54:21 -07:00
|
|
|
#else
|
2016-01-04 22:44:05 +01:00
|
|
|
TEST(AudioCodingModuleTest, TwoWayCommunication) {
|
2015-09-30 21:54:21 -07:00
|
|
|
#endif
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_twowaycom_trace.txt").c_str());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
2016-01-04 22:44:05 +01:00
|
|
|
#endif
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2016-01-04 22:44:05 +01:00
|
|
|
#if defined(WEBRTC_ANDROID)
|
|
|
|
|
TEST(AudioCodingModuleTest, DISABLED_TestStereo) {
|
|
|
|
|
#else
|
|
|
|
|
TEST(AudioCodingModuleTest, TestStereo) {
|
|
|
|
|
#endif
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_stereo_trace.txt").c_str());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::TestStereo(ACM_TEST_MODE).Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
2012-06-18 13:35:52 +00:00
|
|
|
|
2016-01-04 22:44:05 +01:00
|
|
|
#if defined(WEBRTC_ANDROID)
|
|
|
|
|
TEST(AudioCodingModuleTest, DISABLED_TestWebRtcVadDtx) {
|
|
|
|
|
#else
|
|
|
|
|
TEST(AudioCodingModuleTest, TestWebRtcVadDtx) {
|
|
|
|
|
#endif
|
2012-06-18 13:35:52 +00:00
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
2013-08-27 07:33:51 +00:00
|
|
|
"acm_vaddtx_trace.txt").c_str());
|
2015-03-03 12:02:30 +00:00
|
|
|
webrtc::TestWebRtcVadDtx().Perform();
|
|
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(AudioCodingModuleTest, TestOpusDtx) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_opusdtx_trace.txt").c_str());
|
|
|
|
|
webrtc::TestOpusDtx().Perform();
|
2012-06-18 13:35:52 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-15 13:29:17 +00:00
|
|
|
TEST(AudioCodingModuleTest, TestOpus) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
2013-08-27 07:33:51 +00:00
|
|
|
"acm_opus_trace.txt").c_str());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::OpusTest().Perform();
|
2013-03-15 13:29:17 +00:00
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-23 15:16:51 +00:00
|
|
|
TEST(AudioCodingModuleTest, TestPacketLoss) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_packetloss_trace.txt").c_str());
|
|
|
|
|
webrtc::PacketLossTest(1, 10, 10, 1).Perform();
|
|
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(AudioCodingModuleTest, TestPacketLossBurst) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_packetloss_burst_trace.txt").c_str());
|
|
|
|
|
webrtc::PacketLossTest(1, 10, 10, 2).Perform();
|
|
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(AudioCodingModuleTest, TestPacketLossStereo) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_packetloss_trace.txt").c_str());
|
|
|
|
|
webrtc::PacketLossTest(2, 10, 10, 1).Perform();
|
|
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) {
|
|
|
|
|
Trace::CreateTrace();
|
|
|
|
|
Trace::SetTraceFile((webrtc::test::OutputPath() +
|
|
|
|
|
"acm_packetloss_burst_trace.txt").c_str());
|
|
|
|
|
webrtc::PacketLossTest(2, 10, 10, 2).Perform();
|
|
|
|
|
Trace::ReturnTrace();
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-27 07:33:51 +00:00
|
|
|
// 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());
|
2014-04-17 08:29:10 +00:00
|
|
|
webrtc::APITest().Perform();
|
2013-08-27 07:33:51 +00:00
|
|
|
Trace::ReturnTrace();
|
2012-06-12 07:16:24 +00:00
|
|
|
}
|
2013-08-27 07:33:51 +00:00
|
|
|
#endif
|