| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
| 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> | |
| 12 #include <string> | |
| 13 #include <vector> | |
| 14 | |
| 15 #include "testing/gtest/include/gtest/gtest.h" | |
| 16 #include "webrtc/modules/audio_coding/main/include/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" | |
| 21 #include "webrtc/modules/audio_coding/main/test/PacketLossTest.h" | |
| 22 #include "webrtc/modules/audio_coding/main/test/TestAllCodecs.h" | |
| 23 #include "webrtc/modules/audio_coding/main/test/TestRedFec.h" | |
| 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" | |
| 27 #include "webrtc/system_wrappers/include/trace.h" | |
| 28 #include "webrtc/test/testsupport/fileutils.h" | |
| 29 #include "webrtc/test/testsupport/gtest_disable.h" | |
| 30 | |
| 31 using webrtc::Trace; | |
| 32 | |
| 33 // This parameter is used to describe how to run the tests. It is normally | |
| 34 // set to 0, and all tests are run in quite mode. | |
| 35 #define ACM_TEST_MODE 0 | |
| 36 | |
| 37 TEST(AudioCodingModuleTest, TestAllCodecs) { | |
| 38 Trace::CreateTrace(); | |
| 39 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 40 "acm_allcodecs_trace.txt").c_str()); | |
| 41 webrtc::TestAllCodecs(ACM_TEST_MODE).Perform(); | |
| 42 Trace::ReturnTrace(); | |
| 43 } | |
| 44 | |
| 45 TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) { | |
| 46 Trace::CreateTrace(); | |
| 47 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 48 "acm_encodedecode_trace.txt").c_str()); | |
| 49 webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform(); | |
| 50 Trace::ReturnTrace(); | |
| 51 } | |
| 52 | |
| 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))) { | |
| 60 Trace::CreateTrace(); | |
| 61 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 62 "acm_fec_trace.txt").c_str()); | |
| 63 webrtc::TestRedFec().Perform(); | |
| 64 Trace::ReturnTrace(); | |
| 65 } | |
| 66 | |
| 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))) { | |
| 74 Trace::CreateTrace(); | |
| 75 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 76 "acm_isac_trace.txt").c_str()); | |
| 77 webrtc::ISACTest(ACM_TEST_MODE).Perform(); | |
| 78 Trace::ReturnTrace(); | |
| 79 } | |
| 80 | |
| 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))) { | |
| 90 Trace::CreateTrace(); | |
| 91 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 92 "acm_twowaycom_trace.txt").c_str()); | |
| 93 webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform(); | |
| 94 Trace::ReturnTrace(); | |
| 95 } | |
| 96 | |
| 97 TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestStereo)) { | |
| 98 Trace::CreateTrace(); | |
| 99 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 100 "acm_stereo_trace.txt").c_str()); | |
| 101 webrtc::TestStereo(ACM_TEST_MODE).Perform(); | |
| 102 Trace::ReturnTrace(); | |
| 103 } | |
| 104 | |
| 105 TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestWebRtcVadDtx)) { | |
| 106 Trace::CreateTrace(); | |
| 107 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 108 "acm_vaddtx_trace.txt").c_str()); | |
| 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(); | |
| 118 Trace::ReturnTrace(); | |
| 119 } | |
| 120 | |
| 121 TEST(AudioCodingModuleTest, TestOpus) { | |
| 122 Trace::CreateTrace(); | |
| 123 Trace::SetTraceFile((webrtc::test::OutputPath() + | |
| 124 "acm_opus_trace.txt").c_str()); | |
| 125 webrtc::OpusTest().Perform(); | |
| 126 Trace::ReturnTrace(); | |
| 127 } | |
| 128 | |
| 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 | |
| 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()); | |
| 168 webrtc::APITest().Perform(); | |
| 169 Trace::ReturnTrace(); | |
| 170 } | |
| 171 #endif | |
| OLD | NEW |