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 | |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 15 | #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.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 21 | #include "webrtc/modules/audio_coding/main/test/PacketLossTest.h" |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 22 | #include "webrtc/modules/audio_coding/main/test/TestAllCodecs.h" |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 23 | #include "webrtc/modules/audio_coding/main/test/TestRedFec.h" |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 24 | #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" |
Henrik Kjellander | 98f5351 | 2015-10-28 18:17:40 +0100 | [diff] [blame^] | 27 | #include "webrtc/system_wrappers/include/trace.h" |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 28 | #include "webrtc/test/testsupport/fileutils.h" |
henrike@webrtc.org | 89c6740 | 2013-08-02 16:53:47 +0000 | [diff] [blame] | 29 | #include "webrtc/test/testsupport/gtest_disable.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | |
tina.legrand@webrtc.org | 554ae1a | 2011-12-16 10:09:04 +0000 | [diff] [blame] | 31 | using webrtc::Trace; |
| 32 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 33 | // 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] | 34 | // 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] | 35 | #define ACM_TEST_MODE 0 |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 37 | TEST(AudioCodingModuleTest, TestAllCodecs) { |
| 38 | Trace::CreateTrace(); |
| 39 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 40 | "acm_allcodecs_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 41 | webrtc::TestAllCodecs(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 42 | Trace::ReturnTrace(); |
| 43 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 44 | |
andresp@webrtc.org | d0b436a | 2014-01-13 13:15:59 +0000 | [diff] [blame] | 45 | TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 46 | Trace::CreateTrace(); |
| 47 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 48 | "acm_encodedecode_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 49 | webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 50 | Trace::ReturnTrace(); |
| 51 | } |
| 52 | |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 53 | #ifdef WEBRTC_CODEC_RED |
| 54 | #define IF_RED(x) x |
| 55 | #else |
| 56 | #define IF_RED(x) DISABLED_##x |
| 57 | #endif |
| 58 | |
| 59 | TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(IF_RED(TestRedFec))) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 60 | Trace::CreateTrace(); |
| 61 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 62 | "acm_fec_trace.txt").c_str()); |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 63 | webrtc::TestRedFec().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 64 | Trace::ReturnTrace(); |
| 65 | } |
| 66 | |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 67 | #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
| 68 | #define IF_ISAC(x) x |
| 69 | #else |
| 70 | #define IF_ISAC(x) DISABLED_##x |
| 71 | #endif |
| 72 | |
| 73 | TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(IF_ISAC(TestIsac))) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 74 | Trace::CreateTrace(); |
| 75 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 76 | "acm_isac_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 77 | webrtc::ISACTest(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 78 | Trace::ReturnTrace(); |
| 79 | } |
| 80 | |
kwiberg | 98ab3a4 | 2015-09-30 21:54:21 -0700 | [diff] [blame] | 81 | #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \ |
| 82 | defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) |
| 83 | #define IF_ALL_CODECS(x) x |
| 84 | #else |
| 85 | #define IF_ALL_CODECS(x) DISABLED_##x |
| 86 | #endif |
| 87 | |
| 88 | TEST(AudioCodingModuleTest, |
| 89 | DISABLED_ON_ANDROID(IF_ALL_CODECS(TwoWayCommunication))) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 90 | Trace::CreateTrace(); |
| 91 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 92 | "acm_twowaycom_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 93 | webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 94 | Trace::ReturnTrace(); |
| 95 | } |
| 96 | |
andresp@webrtc.org | d0b436a | 2014-01-13 13:15:59 +0000 | [diff] [blame] | 97 | TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestStereo)) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 98 | Trace::CreateTrace(); |
| 99 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 100 | "acm_stereo_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 101 | webrtc::TestStereo(ACM_TEST_MODE).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 102 | Trace::ReturnTrace(); |
| 103 | } |
| 104 | |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 105 | TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestWebRtcVadDtx)) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 106 | Trace::CreateTrace(); |
| 107 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 108 | "acm_vaddtx_trace.txt").c_str()); |
minyue@webrtc.org | 0561716 | 2015-03-03 12:02:30 +0000 | [diff] [blame] | 109 | webrtc::TestWebRtcVadDtx().Perform(); |
| 110 | Trace::ReturnTrace(); |
| 111 | } |
| 112 | |
| 113 | TEST(AudioCodingModuleTest, TestOpusDtx) { |
| 114 | Trace::CreateTrace(); |
| 115 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 116 | "acm_opusdtx_trace.txt").c_str()); |
| 117 | webrtc::TestOpusDtx().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 118 | Trace::ReturnTrace(); |
| 119 | } |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 120 | |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 121 | TEST(AudioCodingModuleTest, TestOpus) { |
| 122 | Trace::CreateTrace(); |
| 123 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 124 | "acm_opus_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 125 | webrtc::OpusTest().Perform(); |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 126 | Trace::ReturnTrace(); |
| 127 | } |
| 128 | |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 129 | TEST(AudioCodingModuleTest, TestPacketLoss) { |
| 130 | Trace::CreateTrace(); |
| 131 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 132 | "acm_packetloss_trace.txt").c_str()); |
| 133 | webrtc::PacketLossTest(1, 10, 10, 1).Perform(); |
| 134 | Trace::ReturnTrace(); |
| 135 | } |
| 136 | |
| 137 | TEST(AudioCodingModuleTest, TestPacketLossBurst) { |
| 138 | Trace::CreateTrace(); |
| 139 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 140 | "acm_packetloss_burst_trace.txt").c_str()); |
| 141 | webrtc::PacketLossTest(1, 10, 10, 2).Perform(); |
| 142 | Trace::ReturnTrace(); |
| 143 | } |
| 144 | |
| 145 | TEST(AudioCodingModuleTest, TestPacketLossStereo) { |
| 146 | Trace::CreateTrace(); |
| 147 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 148 | "acm_packetloss_trace.txt").c_str()); |
| 149 | webrtc::PacketLossTest(2, 10, 10, 1).Perform(); |
| 150 | Trace::ReturnTrace(); |
| 151 | } |
| 152 | |
| 153 | TEST(AudioCodingModuleTest, TestPacketLossStereoBurst) { |
| 154 | Trace::CreateTrace(); |
| 155 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 156 | "acm_packetloss_burst_trace.txt").c_str()); |
| 157 | webrtc::PacketLossTest(2, 10, 10, 2).Perform(); |
| 158 | Trace::ReturnTrace(); |
| 159 | } |
| 160 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 161 | // The full API test is too long to run automatically on bots, but can be used |
| 162 | // for offline testing. User interaction is needed. |
| 163 | #ifdef ACM_TEST_FULL_API |
| 164 | TEST(AudioCodingModuleTest, TestAPI) { |
| 165 | Trace::CreateTrace(); |
| 166 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 167 | "acm_apitest_trace.txt").c_str()); |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 168 | webrtc::APITest().Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 169 | Trace::ReturnTrace(); |
tina.legrand@webrtc.org | 5e7ca60 | 2012-06-12 07:16:24 +0000 | [diff] [blame] | 170 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 171 | #endif |