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" |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 26 | #include "test/gtest.h" |
| 27 | #include "test/testsupport/fileutils.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 29 | // This parameter is used to describe how to run the tests. It is normally |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 30 | // set to 0, and all tests are run in quite mode. |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 31 | #define ACM_TEST_MODE 0 |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 33 | TEST(AudioCodingModuleTest, TestAllCodecs) { |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 34 | webrtc::TestAllCodecs(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 35 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 36 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 37 | #if defined(WEBRTC_ANDROID) |
| 38 | TEST(AudioCodingModuleTest, DISABLED_TestEncodeDecode) { |
| 39 | #else |
| 40 | TEST(AudioCodingModuleTest, TestEncodeDecode) { |
| 41 | #endif |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 42 | webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 45 | #if defined(WEBRTC_CODEC_RED) |
| 46 | #if defined(WEBRTC_ANDROID) |
| 47 | TEST(AudioCodingModuleTest, DISABLED_TestRedFec) { |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 48 | #else |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 49 | TEST(AudioCodingModuleTest, TestRedFec) { |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 50 | #endif |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 51 | webrtc::TestRedFec().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 52 | } |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 53 | #endif |
| 54 | |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 55 | #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
| 56 | #if defined(WEBRTC_ANDROID) |
| 57 | TEST(AudioCodingModuleTest, DISABLED_TestIsac) { |
| 58 | #else |
| 59 | TEST(AudioCodingModuleTest, TestIsac) { |
| 60 | #endif |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 61 | webrtc::ISACTest(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 62 | } |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 63 | #endif |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 64 | |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 65 | #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \ |
| 66 | defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 67 | #if defined(WEBRTC_ANDROID) |
| 68 | TEST(AudioCodingModuleTest, DISABLED_TwoWayCommunication) { |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 69 | #else |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 70 | TEST(AudioCodingModuleTest, TwoWayCommunication) { |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 71 | #endif |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 72 | webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 73 | } |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 74 | #endif |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 75 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 76 | // Disabled on ios as flaky, see https://crbug.com/webrtc/7057 |
| 77 | #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 78 | TEST(AudioCodingModuleTest, DISABLED_TestStereo) { |
| 79 | #else |
| 80 | TEST(AudioCodingModuleTest, TestStereo) { |
| 81 | #endif |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 82 | webrtc::TestStereo(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 83 | } |
| 84 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 85 | // Disabled on ios as flaky, see https://crbug.com/webrtc/7057 |
| 86 | #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
Peter Boström | e2976c8 | 2016-01-04 22:44:05 +0100 | [diff] [blame] | 87 | TEST(AudioCodingModuleTest, DISABLED_TestWebRtcVadDtx) { |
| 88 | #else |
| 89 | TEST(AudioCodingModuleTest, TestWebRtcVadDtx) { |
| 90 | #endif |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 91 | webrtc::TestWebRtcVadDtx().Perform(); |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | TEST(AudioCodingModuleTest, TestOpusDtx) { |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 95 | webrtc::TestOpusDtx().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 96 | } |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 97 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 98 | // Disabled on ios as flaky, see https://crbug.com/webrtc/7057 |
| 99 | #if defined(WEBRTC_IOS) |
| 100 | TEST(AudioCodingModuleTest, DISABLED_TestOpus) { |
| 101 | #else |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 102 | TEST(AudioCodingModuleTest, TestOpus) { |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 103 | #endif |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 104 | webrtc::OpusTest().Perform(); |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 105 | } |
| 106 | |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 107 | TEST(AudioCodingModuleTest, TestPacketLoss) { |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 108 | webrtc::PacketLossTest(1, 10, 10, 1).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | TEST(AudioCodingModuleTest, TestPacketLossBurst) { |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 112 | webrtc::PacketLossTest(1, 10, 10, 2).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 113 | } |
| 114 | |
aleloi | b1a8976 | 2017-03-28 02:28:08 -0700 | [diff] [blame] | 115 | // Disabled on ios as flake, see https://crbug.com/webrtc/7057 |
| 116 | #if defined(WEBRTC_IOS) |
| 117 | TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereo) { |
| 118 | #else |
| 119 | TEST(AudioCodingModuleTest, TestPacketLossStereo) { |
| 120 | #endif |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 121 | webrtc::PacketLossTest(2, 10, 10, 1).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 122 | } |
| 123 | |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 124 | // Disabled on ios as flake, see https://crbug.com/webrtc/7057 |
| 125 | #if defined(WEBRTC_IOS) |
| 126 | TEST(AudioCodingModuleTest, DISABLED_TestPacketLossStereoBurst) { |
| 127 | #else |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 128 | TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) { |
danilchap | dc05017 | 2017-03-01 01:16:51 -0800 | [diff] [blame] | 129 | #endif |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 130 | webrtc::PacketLossTest(2, 10, 10, 2).Perform(); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 131 | } |
| 132 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 133 | // 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.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 137 | webrtc::APITest().Perform(); |
tina.legrand@webrtc.org | 5e7ca60 | 2012-06-12 07:16:24 +0000 | [diff] [blame] | 138 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 139 | #endif |