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

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

Issue 1750353002: Change NetEq::GetAudio to use AudioFrame (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 9 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 // Read too many samples. Expect to get all samples from the vector. 202 // Read too many samples. Expect to get all samples from the vector.
203 EXPECT_EQ(interleaved_length_, 203 EXPECT_EQ(interleaved_length_,
204 vec.ReadInterleaved(array_length() + 1, output)); 204 vec.ReadInterleaved(array_length() + 1, output));
205 EXPECT_EQ(0, 205 EXPECT_EQ(0,
206 memcmp(array_interleaved_, output, read_samples * sizeof(int16_t))); 206 memcmp(array_interleaved_, output, read_samples * sizeof(int16_t)));
207 207
208 delete [] output; 208 delete [] output;
209 } 209 }
210 210
211 // Try to read to a NULL pointer. Expected to return 0.
212 TEST_P(AudioMultiVectorTest, ReadInterleavedToNull) {
213 AudioMultiVector vec(num_channels_);
214 vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
215 int16_t* output = NULL;
216 // Read 5 samples.
217 size_t read_samples = 5;
218 EXPECT_EQ(0u, vec.ReadInterleaved(read_samples, output));
219 }
220
221 // Test the PopFront method. 211 // Test the PopFront method.
222 TEST_P(AudioMultiVectorTest, PopFront) { 212 TEST_P(AudioMultiVectorTest, PopFront) {
223 AudioMultiVector vec(num_channels_); 213 AudioMultiVector vec(num_channels_);
224 vec.PushBackInterleaved(array_interleaved_, interleaved_length_); 214 vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
225 vec.PopFront(1); // Remove one element from each channel. 215 vec.PopFront(1); // Remove one element from each channel.
226 ASSERT_EQ(array_length() - 1u, vec.Size()); 216 ASSERT_EQ(array_length() - 1u, vec.Size());
227 // Let |ptr| point to the second element of the first channel in the 217 // Let |ptr| point to the second element of the first channel in the
228 // interleaved array. 218 // interleaved array.
229 int16_t* ptr = &array_interleaved_[num_channels_]; 219 int16_t* ptr = &array_interleaved_[num_channels_];
230 for (size_t i = 0; i < array_length() - 1; ++i) { 220 for (size_t i = 0; i < array_length() - 1; ++i) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 EXPECT_EQ(vec[0][i], vec[num_channels_ - 1][i]); 314 EXPECT_EQ(vec[0][i], vec[num_channels_ - 1][i]);
325 } 315 }
326 } 316 }
327 317
328 INSTANTIATE_TEST_CASE_P(TestNumChannels, 318 INSTANTIATE_TEST_CASE_P(TestNumChannels,
329 AudioMultiVectorTest, 319 AudioMultiVectorTest,
330 ::testing::Values(static_cast<size_t>(1), 320 ::testing::Values(static_cast<size_t>(1),
331 static_cast<size_t>(2), 321 static_cast<size_t>(2),
332 static_cast<size_t>(5))); 322 static_cast<size_t>(5)));
333 } // namespace webrtc 323 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_multi_vector.cc ('k') | webrtc/modules/audio_coding/neteq/include/neteq.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698