blob: 22510f34161cbf53d4ed26bf2f5b0fe5d7fab985 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tina.legrand@webrtc.org16b6b902012-04-12 11:02:38 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include <stdio.h>
kjellander@webrtc.org5490c712011-12-21 13:34:18 +000012#include <string>
niklase@google.com470e71d2011-07-07 08:21:25 +000013#include <vector>
14
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000015#include "testing/gtest/include/gtest/gtest.h"
16#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
17#include "webrtc/modules/audio_coding/main/test/APITest.h"
18#include "webrtc/modules/audio_coding/main/test/EncodeDecodeTest.h"
19#include "webrtc/modules/audio_coding/main/test/iSACTest.h"
20#include "webrtc/modules/audio_coding/main/test/opus_test.h"
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000021#include "webrtc/modules/audio_coding/main/test/PacketLossTest.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000022#include "webrtc/modules/audio_coding/main/test/TestAllCodecs.h"
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000023#include "webrtc/modules/audio_coding/main/test/TestRedFec.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000024#include "webrtc/modules/audio_coding/main/test/TestStereo.h"
25#include "webrtc/modules/audio_coding/main/test/TestVADDTX.h"
26#include "webrtc/modules/audio_coding/main/test/TwoWayCommunication.h"
27#include "webrtc/system_wrappers/interface/trace.h"
28#include "webrtc/test/testsupport/fileutils.h"
henrike@webrtc.org89c67402013-08-02 16:53:47 +000029#include "webrtc/test/testsupport/gtest_disable.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000030
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000031using webrtc::Trace;
32
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000033// This parameter is used to describe how to run the tests. It is normally
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000034// set to 0, and all tests are run in quite mode.
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000035#define ACM_TEST_MODE 0
niklase@google.com470e71d2011-07-07 08:21:25 +000036
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000037TEST(AudioCodingModuleTest, TestAllCodecs) {
38 Trace::CreateTrace();
39 Trace::SetTraceFile((webrtc::test::OutputPath() +
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000040 "acm_allcodecs_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000041 webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000042 Trace::ReturnTrace();
43}
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000044
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000045TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000046 Trace::CreateTrace();
47 Trace::SetTraceFile((webrtc::test::OutputPath() +
48 "acm_encodedecode_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000049 webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000050 Trace::ReturnTrace();
51}
52
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000053TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestRedFec)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000054 Trace::CreateTrace();
55 Trace::SetTraceFile((webrtc::test::OutputPath() +
56 "acm_fec_trace.txt").c_str());
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000057 webrtc::TestRedFec().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000058 Trace::ReturnTrace();
59}
60
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000061TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestIsac)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000062 Trace::CreateTrace();
63 Trace::SetTraceFile((webrtc::test::OutputPath() +
64 "acm_isac_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000065 webrtc::ISACTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000066 Trace::ReturnTrace();
67}
68
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000069TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TwoWayCommunication)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000070 Trace::CreateTrace();
71 Trace::SetTraceFile((webrtc::test::OutputPath() +
72 "acm_twowaycom_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000073 webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000074 Trace::ReturnTrace();
75}
76
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000077TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestStereo)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000078 Trace::CreateTrace();
79 Trace::SetTraceFile((webrtc::test::OutputPath() +
80 "acm_stereo_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000081 webrtc::TestStereo(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000082 Trace::ReturnTrace();
83}
84
minyue@webrtc.org05617162015-03-03 12:02:30 +000085TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestWebRtcVadDtx)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000086 Trace::CreateTrace();
87 Trace::SetTraceFile((webrtc::test::OutputPath() +
88 "acm_vaddtx_trace.txt").c_str());
minyue@webrtc.org05617162015-03-03 12:02:30 +000089 webrtc::TestWebRtcVadDtx().Perform();
90 Trace::ReturnTrace();
91}
92
93TEST(AudioCodingModuleTest, TestOpusDtx) {
94 Trace::CreateTrace();
95 Trace::SetTraceFile((webrtc::test::OutputPath() +
96 "acm_opusdtx_trace.txt").c_str());
97 webrtc::TestOpusDtx().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000098 Trace::ReturnTrace();
99}
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000100
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +0000101TEST(AudioCodingModuleTest, TestOpus) {
102 Trace::CreateTrace();
103 Trace::SetTraceFile((webrtc::test::OutputPath() +
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000104 "acm_opus_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +0000105 webrtc::OpusTest().Perform();
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +0000106 Trace::ReturnTrace();
107}
108
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000109TEST(AudioCodingModuleTest, TestPacketLoss) {
110 Trace::CreateTrace();
111 Trace::SetTraceFile((webrtc::test::OutputPath() +
112 "acm_packetloss_trace.txt").c_str());
113 webrtc::PacketLossTest(1, 10, 10, 1).Perform();
114 Trace::ReturnTrace();
115}
116
117TEST(AudioCodingModuleTest, TestPacketLossBurst) {
118 Trace::CreateTrace();
119 Trace::SetTraceFile((webrtc::test::OutputPath() +
120 "acm_packetloss_burst_trace.txt").c_str());
121 webrtc::PacketLossTest(1, 10, 10, 2).Perform();
122 Trace::ReturnTrace();
123}
124
125TEST(AudioCodingModuleTest, TestPacketLossStereo) {
126 Trace::CreateTrace();
127 Trace::SetTraceFile((webrtc::test::OutputPath() +
128 "acm_packetloss_trace.txt").c_str());
129 webrtc::PacketLossTest(2, 10, 10, 1).Perform();
130 Trace::ReturnTrace();
131}
132
133TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) {
134 Trace::CreateTrace();
135 Trace::SetTraceFile((webrtc::test::OutputPath() +
136 "acm_packetloss_burst_trace.txt").c_str());
137 webrtc::PacketLossTest(2, 10, 10, 2).Perform();
138 Trace::ReturnTrace();
139}
140
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000141// The full API test is too long to run automatically on bots, but can be used
142// for offline testing. User interaction is needed.
143#ifdef ACM_TEST_FULL_API
144 TEST(AudioCodingModuleTest, TestAPI) {
145 Trace::CreateTrace();
146 Trace::SetTraceFile((webrtc::test::OutputPath() +
147 "acm_apitest_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +0000148 webrtc::APITest().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000149 Trace::ReturnTrace();
tina.legrand@webrtc.org5e7ca602012-06-12 07:16:24 +0000150 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000151#endif