blob: 73625f17084ae3d883ace35442a45fc35078538b [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"
16#include "modules/audio_coding/test/APITest.h"
17#include "modules/audio_coding/test/EncodeDecodeTest.h"
18#include "modules/audio_coding/test/PacketLossTest.h"
19#include "modules/audio_coding/test/TestAllCodecs.h"
20#include "modules/audio_coding/test/TestRedFec.h"
21#include "modules/audio_coding/test/TestStereo.h"
22#include "modules/audio_coding/test/TestVADDTX.h"
23#include "modules/audio_coding/test/TwoWayCommunication.h"
24#include "modules/audio_coding/test/iSACTest.h"
25#include "modules/audio_coding/test/opus_test.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020026#include "test/gtest.h"
27#include "test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000028
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000029// This parameter is used to describe how to run the tests. It is normally
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000030// set to 0, and all tests are run in quite mode.
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000031#define ACM_TEST_MODE 0
niklase@google.com470e71d2011-07-07 08:21:25 +000032
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000033TEST(AudioCodingModuleTest, TestAllCodecs) {
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000034 webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000035}
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000036
Peter Boströme2976c82016-01-04 22:44:05 +010037#if defined(WEBRTC_ANDROID)
38TEST(AudioCodingModuleTest, DISABLED_TestEncodeDecode) {
39#else
40TEST(AudioCodingModuleTest, TestEncodeDecode) {
41#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000042 webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000043}
44
Peter Boströme2976c82016-01-04 22:44:05 +010045#if defined(WEBRTC_CODEC_RED)
46#if defined(WEBRTC_ANDROID)
47TEST(AudioCodingModuleTest, DISABLED_TestRedFec) {
kwiberg98ab3a42015-09-30 21:54:21 -070048#else
Peter Boströme2976c82016-01-04 22:44:05 +010049TEST(AudioCodingModuleTest, TestRedFec) {
kwiberg98ab3a42015-09-30 21:54:21 -070050#endif
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000051 webrtc::TestRedFec().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000052}
kwiberg98ab3a42015-09-30 21:54:21 -070053#endif
54
Peter Boströme2976c82016-01-04 22:44:05 +010055#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
56#if defined(WEBRTC_ANDROID)
57TEST(AudioCodingModuleTest, DISABLED_TestIsac) {
58#else
59TEST(AudioCodingModuleTest, TestIsac) {
60#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000061 webrtc::ISACTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000062}
Peter Boströme2976c82016-01-04 22:44:05 +010063#endif
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000064
kwiberg98ab3a42015-09-30 21:54:21 -070065#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
66 defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
Peter Boströme2976c82016-01-04 22:44:05 +010067#if defined(WEBRTC_ANDROID)
68TEST(AudioCodingModuleTest, DISABLED_TwoWayCommunication) {
kwiberg98ab3a42015-09-30 21:54:21 -070069#else
Peter Boströme2976c82016-01-04 22:44:05 +010070TEST(AudioCodingModuleTest, TwoWayCommunication) {
kwiberg98ab3a42015-09-30 21:54:21 -070071#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000072 webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000073}
Peter Boströme2976c82016-01-04 22:44:05 +010074#endif
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000075
danilchapdc050172017-03-01 01:16:51 -080076// Disabled on ios as flaky, see https://crbug.com/webrtc/7057
77#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Peter Boströme2976c82016-01-04 22:44:05 +010078TEST(AudioCodingModuleTest, DISABLED_TestStereo) {
79#else
80TEST(AudioCodingModuleTest, TestStereo) {
81#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000082 webrtc::TestStereo(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000083}
84
danilchapdc050172017-03-01 01:16:51 -080085// Disabled on ios as flaky, see https://crbug.com/webrtc/7057
86#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Peter Boströme2976c82016-01-04 22:44:05 +010087TEST(AudioCodingModuleTest, DISABLED_TestWebRtcVadDtx) {
88#else
89TEST(AudioCodingModuleTest, TestWebRtcVadDtx) {
90#endif
minyue@webrtc.org05617162015-03-03 12:02:30 +000091 webrtc::TestWebRtcVadDtx().Perform();
minyue@webrtc.org05617162015-03-03 12:02:30 +000092}
93
94TEST(AudioCodingModuleTest, TestOpusDtx) {
minyue@webrtc.org05617162015-03-03 12:02:30 +000095 webrtc::TestOpusDtx().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000096}
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000097
danilchapdc050172017-03-01 01:16:51 -080098// Disabled on ios as flaky, see https://crbug.com/webrtc/7057
99#if defined(WEBRTC_IOS)
100TEST(AudioCodingModuleTest, DISABLED_TestOpus) {
101#else
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +0000102TEST(AudioCodingModuleTest, TestOpus) {
danilchapdc050172017-03-01 01:16:51 -0800103#endif
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +0000104 webrtc::OpusTest().Perform();
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +0000105}
106
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000107TEST(AudioCodingModuleTest, TestPacketLoss) {
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000108 webrtc::PacketLossTest(1, 10, 10, 1).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000109}
110
111TEST(AudioCodingModuleTest, TestPacketLossBurst) {
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000112 webrtc::PacketLossTest(1, 10, 10, 2).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000113}
114
aleloib1a89762017-03-28 02:28:08 -0700115// Disabled on ios as flake, see https://crbug.com/webrtc/7057
116#if defined(WEBRTC_IOS)
117TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereo) {
118#else
119 TEST(AudioCodingModuleTest, TestPacketLossStereo) {
120#endif
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000121 webrtc::PacketLossTest(2, 10, 10, 1).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000122}
123
danilchapdc050172017-03-01 01:16:51 -0800124// Disabled on ios as flake, see https://crbug.com/webrtc/7057
125#if defined(WEBRTC_IOS)
126TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereoBurst) {
127#else
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000128TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) {
danilchapdc050172017-03-01 01:16:51 -0800129#endif
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000130 webrtc::PacketLossTest(2, 10, 10, 2).Perform();
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +0000131}
132
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000133// The full API test is too long to run automatically on bots, but can be used
134// for offline testing. User interaction is needed.
135#ifdef ACM_TEST_FULL_API
136 TEST(AudioCodingModuleTest, TestAPI) {
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +0000137 webrtc::APITest().Perform();
tina.legrand@webrtc.org5e7ca602012-06-12 07:16:24 +0000138 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000139#endif