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

Side by Side Diff: webrtc/modules/audio_coding/neteq/expand_unittest.cc

Issue 1948483002: Using ring buffer for AudioVector in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months 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
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void SetUp() override { 88 void SetUp() override {
89 // Fast-forward the input file until there is speech (about 1.1 second into 89 // Fast-forward the input file until there is speech (about 1.1 second into
90 // the file). 90 // the file).
91 const size_t speech_start_samples = 91 const size_t speech_start_samples =
92 static_cast<size_t>(test_sample_rate_hz_ * 1.1f); 92 static_cast<size_t>(test_sample_rate_hz_ * 1.1f);
93 ASSERT_TRUE(input_file_.Seek(speech_start_samples)); 93 ASSERT_TRUE(input_file_.Seek(speech_start_samples));
94 94
95 // Pre-load the sync buffer with speech data. 95 // Pre-load the sync buffer with speech data.
96 ASSERT_TRUE( 96 std::unique_ptr<int16_t[]> temp(new int16_t[sync_buffer_.Size()]);
97 input_file_.Read(sync_buffer_.Size(), &sync_buffer_.Channel(0)[0])); 97 ASSERT_TRUE(input_file_.Read(sync_buffer_.Size(), temp.get()));
98 sync_buffer_.Channel(0).OverwriteAt(temp.get(), sync_buffer_.Size(), 0);
98 ASSERT_EQ(1u, num_channels_) << "Fix: Must populate all channels."; 99 ASSERT_EQ(1u, num_channels_) << "Fix: Must populate all channels.";
99 } 100 }
100 101
101 test::ResampleInputAudioFile input_file_; 102 test::ResampleInputAudioFile input_file_;
102 int test_sample_rate_hz_; 103 int test_sample_rate_hz_;
103 size_t num_channels_; 104 size_t num_channels_;
104 BackgroundNoise background_noise_; 105 BackgroundNoise background_noise_;
105 SyncBuffer sync_buffer_; 106 SyncBuffer sync_buffer_;
106 RandomVector random_vector_; 107 RandomVector random_vector_;
107 FakeStatisticsCalculator statistics_; 108 FakeStatisticsCalculator statistics_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 expand_.SetParametersForNormalAfterExpand(); 166 expand_.SetParametersForNormalAfterExpand();
166 // Convert |sum_output_len_samples| to milliseconds. 167 // Convert |sum_output_len_samples| to milliseconds.
167 EXPECT_EQ(rtc::checked_cast<int>(sum_output_len_samples / 168 EXPECT_EQ(rtc::checked_cast<int>(sum_output_len_samples /
168 (test_sample_rate_hz_ / 1000)), 169 (test_sample_rate_hz_ / 1000)),
169 statistics_.last_outage_duration_ms()); 170 statistics_.last_outage_duration_ms());
170 } 171 }
171 172
172 // TODO(hlundin): Write more tests. 173 // TODO(hlundin): Write more tests.
173 174
174 } // namespace webrtc 175 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698