niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
tina.legrand@webrtc.org | 16b6b90 | 2012-04-12 11:02:38 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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.org | 5490c71 | 2011-12-21 13:34:18 +0000 | [diff] [blame] | 12 | #include <string> |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | #include <vector> |
| 14 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 15 | #include "modules/audio_coding/include/audio_coding_module.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "test/gtest.h" |
| 26 | #include "test/testsupport/fileutils.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
Fredrik Solenberg | ec0f45b | 2018-12-03 15:50:44 +0000 | [diff] [blame] | 28 | // This parameter is used to describe how to run the tests. It is normally |
| 29 | // set to 0, and all tests are run in quite mode. |
| 30 | #define ACM_TEST_MODE 0 |
| 31 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 32 | TEST(AudioCodingModuleTest, TestAllCodecs) { |
Fredrik Solenberg | ec0f45b | 2018-12-03 15:50:44 +0000 | [diff] [blame] | 33 | webrtc::TestAllCodecs(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 34 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 35 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 36 | #if defined(WEBRTC_ANDROID) |
| 37 | TEST(AudioCodingModuleTest, DISABLED_TestEncodeDecode) { |
| 38 | #else |
| 39 | TEST(AudioCodingModuleTest, TestEncodeDecode) { |
| 40 | #endif |
Fredrik Solenberg | ec0f45b | 2018-12-03 15:50:44 +0000 | [diff] [blame] | 41 | webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 42 | } |
| 43 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 44 | TEST(AudioCodingModuleTest, TestRedFec) { |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 45 | webrtc::TestRedFec().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 46 | } |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 47 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 48 | #if defined(WEBRTC_ANDROID) |
| 49 | TEST(AudioCodingModuleTest, DISABLED_TestIsac) { |
| 50 | #else |
| 51 | TEST(AudioCodingModuleTest, TestIsac) { |
| 52 | #endif |
Fredrik Solenberg | ec0f45b | 2018-12-03 15:50:44 +0000 | [diff] [blame] | 53 | webrtc::ISACTest(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 54 | } |
| 55 | |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 56 | #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \ |
Karl Wiberg | eb254b4 | 2017-11-01 15:08:12 +0100 | [diff] [blame] | 57 | defined(WEBRTC_CODEC_ILBC) |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 58 | #if defined(WEBRTC_ANDROID) |
| 59 | TEST(AudioCodingModuleTest, DISABLED_TwoWayCommunication) { |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 60 | #else |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 61 | TEST(AudioCodingModuleTest, TwoWayCommunication) { |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 62 | #endif |
Karl Wiberg | 3a6b6bd | 2018-09-26 10:38:45 +0200 | [diff] [blame] | 63 | webrtc::TwoWayCommunication().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 64 | } |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 65 | #endif |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 66 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 67 | // Disabled on ios as flaky, see https://crbug.com/webrtc/7057 |
| 68 | #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 69 | TEST(AudioCodingModuleTest, DISABLED_TestStereo) { |
| 70 | #else |
| 71 | TEST(AudioCodingModuleTest, TestStereo) { |
| 72 | #endif |
Fredrik Solenberg | ec0f45b | 2018-12-03 15:50:44 +0000 | [diff] [blame] | 73 | webrtc::TestStereo(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 76 | TEST(AudioCodingModuleTest, TestWebRtcVadDtx) { |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 77 | webrtc::TestWebRtcVadDtx().Perform(); |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | TEST(AudioCodingModuleTest, TestOpusDtx) { |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 81 | webrtc::TestOpusDtx().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 82 | } |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 83 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 84 | // Disabled on ios as flaky, see https://crbug.com/webrtc/7057 |
| 85 | #if defined(WEBRTC_IOS) |
| 86 | TEST(AudioCodingModuleTest, DISABLED_TestOpus) { |
| 87 | #else |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 88 | TEST(AudioCodingModuleTest, TestOpus) { |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 89 | #endif |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 90 | webrtc::OpusTest().Perform(); |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 91 | } |
| 92 | |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 93 | TEST(AudioCodingModuleTest, TestPacketLoss) { |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 94 | webrtc::PacketLossTest(1, 10, 10, 1).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | TEST(AudioCodingModuleTest, TestPacketLossBurst) { |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 98 | webrtc::PacketLossTest(1, 10, 10, 2).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 99 | } |
| 100 | |
aleloi | b1a8976 | 2017-03-28 02:28:08 -0700 | [diff] [blame] | 101 | // Disabled on ios as flake, see https://crbug.com/webrtc/7057 |
| 102 | #if defined(WEBRTC_IOS) |
| 103 | TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereo) { |
| 104 | #else |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 105 | TEST(AudioCodingModuleTest, TestPacketLossStereo) { |
aleloi | b1a8976 | 2017-03-28 02:28:08 -0700 | [diff] [blame] | 106 | #endif |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 107 | webrtc::PacketLossTest(2, 10, 10, 1).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 108 | } |
| 109 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 110 | // Disabled on ios as flake, see https://crbug.com/webrtc/7057 |
| 111 | #if defined(WEBRTC_IOS) |
| 112 | TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereoBurst) { |
| 113 | #else |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 114 | TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) { |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 115 | #endif |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 116 | webrtc::PacketLossTest(2, 10, 10, 2).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 117 | } |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 118 | |
| 119 | // The full API test is too long to run automatically on bots, but can be used |
| 120 | // for offline testing. User interaction is needed. |
| 121 | #ifdef ACM_TEST_FULL_API |
| 122 | TEST(AudioCodingModuleTest, TestAPI) { |
| 123 | webrtc::APITest().Perform(); |
| 124 | } |
| 125 | #endif |