Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: webrtc/modules/audio_coding/test/TestVADDTX.cc

Issue 1513223002: Reduce the runtime of some ACM tests in modules_tests (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/audio_coding/test/TestVADDTX.h" 11 #include "webrtc/modules/audio_coding/test/TestVADDTX.h"
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "webrtc/base/checks.h"
15 #include "webrtc/engine_configurations.h" 16 #include "webrtc/engine_configurations.h"
16 #include "webrtc/modules/audio_coding/test/PCMFile.h" 17 #include "webrtc/modules/audio_coding/test/PCMFile.h"
17 #include "webrtc/modules/audio_coding/test/utility.h" 18 #include "webrtc/modules/audio_coding/test/utility.h"
18 #include "webrtc/test/testsupport/fileutils.h" 19 #include "webrtc/test/testsupport/fileutils.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 #ifdef WEBRTC_CODEC_ISAC 23 #ifdef WEBRTC_CODEC_ISAC
23 const CodecInst kIsacWb = {103, "ISAC", 16000, 480, 1, 32000}; 24 const CodecInst kIsacWb = {103, "ISAC", 16000, 480, 1, 32000};
24 const CodecInst kIsacSwb = {104, "ISAC", 32000, 960, 1, 56000}; 25 const CodecInst kIsacSwb = {104, "ISAC", 32000, 960, 1, 56000};
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Encoding a file and see if the numbers that various packets occur follow 81 // Encoding a file and see if the numbers that various packets occur follow
81 // the expectation. 82 // the expectation.
82 void TestVadDtx::Run(std::string in_filename, int frequency, int channels, 83 void TestVadDtx::Run(std::string in_filename, int frequency, int channels,
83 std::string out_filename, bool append, 84 std::string out_filename, bool append,
84 const int* expects) { 85 const int* expects) {
85 monitor_->ResetStatistics(); 86 monitor_->ResetStatistics();
86 87
87 PCMFile in_file; 88 PCMFile in_file;
88 in_file.Open(in_filename, frequency, "rb"); 89 in_file.Open(in_filename, frequency, "rb");
89 in_file.ReadStereo(channels > 1); 90 in_file.ReadStereo(channels > 1);
91 static const int kTestLengthMs = 1000;
92 const int test_length_blocks = rtc::CheckedDivExact(kTestLengthMs, 10);
93 in_file.SetNum10MsBlocksToRead(test_length_blocks);
94 // Fast-forward both files 500 ms (50 blocks). The first second of the file is
95 // silence, but we want to keep half of that to test silence periods.
96 in_file.FastForward(50);
90 97
91 PCMFile out_file; 98 PCMFile out_file;
92 if (append) { 99 if (append) {
93 out_file.Open(out_filename, kOutputFreqHz, "ab"); 100 out_file.Open(out_filename, kOutputFreqHz, "ab");
94 } else { 101 } else {
95 out_file.Open(out_filename, kOutputFreqHz, "wb"); 102 out_file.Open(out_filename, kOutputFreqHz, "wb");
96 } 103 }
97 104
98 uint16_t frame_size_samples = in_file.PayloadLength10Ms(); 105 uint16_t frame_size_samples = in_file.PayloadLength10Ms();
99 uint32_t time_stamp = 0x12345678; 106 uint32_t time_stamp = 0x12345678;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 269
263 EXPECT_EQ(0, acm_send_->EnableOpusDtx()); 270 EXPECT_EQ(0, acm_send_->EnableOpusDtx());
264 271
265 expects[kEmptyFrame] = 1; 272 expects[kEmptyFrame] = 1;
266 Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), 273 Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"),
267 32000, 2, out_filename, true, expects); 274 32000, 2, out_filename, true, expects);
268 #endif 275 #endif
269 } 276 }
270 277
271 } // namespace webrtc 278 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698