OLD | NEW |
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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Encoding a file and see if the numbers that various packets occur follow | 80 // Encoding a file and see if the numbers that various packets occur follow |
81 // the expectation. | 81 // the expectation. |
82 void TestVadDtx::Run(std::string in_filename, int frequency, int channels, | 82 void TestVadDtx::Run(std::string in_filename, int frequency, int channels, |
83 std::string out_filename, bool append, | 83 std::string out_filename, bool append, |
84 const int* expects) { | 84 const int* expects) { |
85 monitor_->ResetStatistics(); | 85 monitor_->ResetStatistics(); |
86 | 86 |
87 PCMFile in_file; | 87 PCMFile in_file; |
88 in_file.Open(in_filename, frequency, "rb"); | 88 in_file.Open(in_filename, frequency, "rb"); |
89 in_file.ReadStereo(channels > 1); | 89 in_file.ReadStereo(channels > 1); |
| 90 // Set test length to 1000 ms (100 blocks of 10 ms each). |
| 91 in_file.SetNum10MsBlocksToRead(100); |
| 92 // Fast-forward both files 500 ms (50 blocks). The first second of the file is |
| 93 // silence, but we want to keep half of that to test silence periods. |
| 94 in_file.FastForward(50); |
90 | 95 |
91 PCMFile out_file; | 96 PCMFile out_file; |
92 if (append) { | 97 if (append) { |
93 out_file.Open(out_filename, kOutputFreqHz, "ab"); | 98 out_file.Open(out_filename, kOutputFreqHz, "ab"); |
94 } else { | 99 } else { |
95 out_file.Open(out_filename, kOutputFreqHz, "wb"); | 100 out_file.Open(out_filename, kOutputFreqHz, "wb"); |
96 } | 101 } |
97 | 102 |
98 uint16_t frame_size_samples = in_file.PayloadLength10Ms(); | 103 uint16_t frame_size_samples = in_file.PayloadLength10Ms(); |
99 uint32_t time_stamp = 0x12345678; | 104 uint32_t time_stamp = 0x12345678; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 267 |
263 EXPECT_EQ(0, acm_send_->EnableOpusDtx()); | 268 EXPECT_EQ(0, acm_send_->EnableOpusDtx()); |
264 | 269 |
265 expects[kEmptyFrame] = 1; | 270 expects[kEmptyFrame] = 1; |
266 Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), | 271 Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), |
267 32000, 2, out_filename, true, expects); | 272 32000, 2, out_filename, true, expects); |
268 #endif | 273 #endif |
269 } | 274 } |
270 | 275 |
271 } // namespace webrtc | 276 } // namespace webrtc |
OLD | NEW |