Reduce the runtime of some ACM tests in modules_tests
By reducing the length of the audio input, the total runtime of
$ out/Debug/modules_tests --gtest_filter=AudioCodingModuleTest.*
is reduced by more than 10x, when run single-threaded.
The PCMFile helper class is extended with a FastForward method (to
skip initial silence in the test files) and a limiter on how much to
read.
BUG=webrtc:2463
R=ivoc@webrtc.org
Review URL: https://codereview.webrtc.org/1513223002 .
Cr-Commit-Position: refs/heads/master@{#10973}
diff --git a/webrtc/modules/audio_coding/test/TestAllCodecs.cc b/webrtc/modules/audio_coding/test/TestAllCodecs.cc
index 21ce7c1..bacfd37 100644
--- a/webrtc/modules/audio_coding/test/TestAllCodecs.cc
+++ b/webrtc/modules/audio_coding/test/TestAllCodecs.cc
@@ -422,8 +422,12 @@
uint32_t timestamp_diff;
channel->reset_payload_size();
int error_count = 0;
-
int counter = 0;
+ // Set test length to 500 ms (50 blocks of 10 ms each).
+ infile_a_.SetNum10MsBlocksToRead(50);
+ // Fast-forward 1 second (100 blocks) since the file starts with silence.
+ infile_a_.FastForward(100);
+
while (!infile_a_.EndOfFile()) {
// Add 10 msec to ACM.
infile_a_.Read10MsData(audio_frame);