blob: 8ce50a413bb2e69ccb843c366af72c1487e13da3 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "modules/audio_coding/include/audio_coding_module.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "modules/audio_coding/test/EncodeDecodeTest.h"
17#include "modules/audio_coding/test/PacketLossTest.h"
18#include "modules/audio_coding/test/TestAllCodecs.h"
19#include "modules/audio_coding/test/TestRedFec.h"
20#include "modules/audio_coding/test/TestStereo.h"
21#include "modules/audio_coding/test/TestVADDTX.h"
22#include "modules/audio_coding/test/TwoWayCommunication.h"
23#include "modules/audio_coding/test/iSACTest.h"
24#include "modules/audio_coding/test/opus_test.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020025#include "test/gtest.h"
26#include "test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000027
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000028// This parameter is used to describe how to run the tests. It is normally
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000029// set to 0, and all tests are run in quite mode.
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000030#define ACM_TEST_MODE 0
niklase@google.com470e71d2011-07-07 08:21:25 +000031
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000032TEST(AudioCodingModuleTest, TestAllCodecs) {
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000033 webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000034}
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000035
Peter Boströme2976c82016-01-04 22:44:05 +010036#if defined(WEBRTC_ANDROID)
37TEST(AudioCodingModuleTest, DISABLED_TestEncodeDecode) {
38#else
39TEST(AudioCodingModuleTest, TestEncodeDecode) {
40#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000041 webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000042}
43
Peter Boströme2976c82016-01-04 22:44:05 +010044#if defined(WEBRTC_CODEC_RED)
45#if defined(WEBRTC_ANDROID)
46TEST(AudioCodingModuleTest, DISABLED_TestRedFec) {
kwiberg98ab3a42015-09-30 21:54:21 -070047#else
Peter Boströme2976c82016-01-04 22:44:05 +010048TEST(AudioCodingModuleTest, TestRedFec) {
kwiberg98ab3a42015-09-30 21:54:21 -070049#endif
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000050 webrtc::TestRedFec().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000051}
kwiberg98ab3a42015-09-30 21:54:21 -070052#endif
53
Peter Boströme2976c82016-01-04 22:44:05 +010054#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
55#if defined(WEBRTC_ANDROID)
56TEST(AudioCodingModuleTest, DISABLED_TestIsac) {
57#else
58TEST(AudioCodingModuleTest, TestIsac) {
59#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000060 webrtc::ISACTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000061}
Peter Boströme2976c82016-01-04 22:44:05 +010062#endif
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000063
kwiberg98ab3a42015-09-30 21:54:21 -070064#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
Karl Wibergeb254b42017-11-01 15:08:12 +010065 defined(WEBRTC_CODEC_ILBC)
Peter Boströme2976c82016-01-04 22:44:05 +010066#if defined(WEBRTC_ANDROID)
67TEST(AudioCodingModuleTest, DISABLED_TwoWayCommunication) {
kwiberg98ab3a42015-09-30 21:54:21 -070068#else
Peter Boströme2976c82016-01-04 22:44:05 +010069TEST(AudioCodingModuleTest, TwoWayCommunication) {
kwiberg98ab3a42015-09-30 21:54:21 -070070#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000071 webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000072}
Peter Boströme2976c82016-01-04 22:44:05 +010073#endif
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000074
danilchapdc050172017-03-01 01:16:51 -080075// Disabled on ios as flaky, see https://crbug.com/webrtc/7057
76#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Peter Boströme2976c82016-01-04 22:44:05 +010077TEST(AudioCodingModuleTest, DISABLED_TestStereo) {
78#else
79TEST(AudioCodingModuleTest, TestStereo) {
80#endif
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}
83
danilchapdc050172017-03-01 01:16:51 -080084// Disabled on ios as flaky, see https://crbug.com/webrtc/7057
85#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Peter Boströme2976c82016-01-04 22:44:05 +010086TEST(AudioCodingModuleTest, DISABLED_TestWebRtcVadDtx) {
87#else
88TEST(AudioCodingModuleTest, TestWebRtcVadDtx) {
89#endif
minyue@webrtc.org05617162015-03-03 12:02:30 +000090 webrtc::TestWebRtcVadDtx().Perform();
minyue@webrtc.org05617162015-03-03 12:02:30 +000091}
92
93TEST(AudioCodingModuleTest, TestOpusDtx) {
minyue@webrtc.org05617162015-03-03 12:02:30 +000094 webrtc::TestOpusDtx().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000095}
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000096
danilchapdc050172017-03-01 01:16:51 -080097// Disabled on ios as flaky, see https://crbug.com/webrtc/7057
98#if defined(WEBRTC_IOS)
99TEST(AudioCodingModuleTest, DISABLED_TestOpus) {
100#else
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +0000101TEST(AudioCodingModuleTest, TestOpus) {
danilchapdc050172017-03-01 01:16:51 -0800102#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +0000103 webrtc::OpusTest().Perform();
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +0000104}
105
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000106TEST(AudioCodingModuleTest, TestPacketLoss) {
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000107 webrtc::PacketLossTest(1, 10, 10, 1).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000108}
109
110TEST(AudioCodingModuleTest, TestPacketLossBurst) {
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000111 webrtc::PacketLossTest(1, 10, 10, 2).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000112}
113
aleloib1a89762017-03-28 02:28:08 -0700114// Disabled on ios as flake, see https://crbug.com/webrtc/7057
115#if defined(WEBRTC_IOS)
116TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereo) {
117#else
Yves Gerey665174f2018-06-19 15:03:05 +0200118TEST(AudioCodingModuleTest, TestPacketLossStereo) {
aleloib1a89762017-03-28 02:28:08 -0700119#endif
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000120 webrtc::PacketLossTest(2, 10, 10, 1).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000121}
122
danilchapdc050172017-03-01 01:16:51 -0800123// Disabled on ios as flake, see https://crbug.com/webrtc/7057
124#if defined(WEBRTC_IOS)
125TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereoBurst) {
126#else
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000127TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) {
danilchapdc050172017-03-01 01:16:51 -0800128#endif
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000129 webrtc::PacketLossTest(2, 10, 10, 2).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000130}
Yves Gerey665174f2018-06-19 15:03:05 +0200131
132// The full API test is too long to run automatically on bots, but can be used
133// for offline testing. User interaction is needed.
134#ifdef ACM_TEST_FULL_API
135TEST(AudioCodingModuleTest, TestAPI) {
136 webrtc::APITest().Perform();
137}
138#endif