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

Side by Side Diff: media/base/audio_bus_unittest.cc

Issue 11098031: Get PulseAudio implementation working. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « media/base/audio_bus.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "media/audio/audio_parameters.h" 9 #include "media/audio/audio_parameters.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 { 328 {
329 SCOPED_TRACE("int32"); 329 SCOPED_TRACE("int32");
330 int32 test_array[arraysize(kTestVectorInt32)]; 330 int32 test_array[arraysize(kTestVectorInt32)];
331 bus->ToInterleaved(bus->frames(), sizeof(*kTestVectorInt32), test_array); 331 bus->ToInterleaved(bus->frames(), sizeof(*kTestVectorInt32), test_array);
332 ASSERT_EQ(memcmp( 332 ASSERT_EQ(memcmp(
333 test_array, kTestVectorInt32, arraysize(kTestVectorInt32)), 0); 333 test_array, kTestVectorInt32, arraysize(kTestVectorInt32)), 0);
334 } 334 }
335 } 335 }
336 336
337 // Verify ToInterleavedPartial() interleaves audio correctly.
338 TEST_F(AudioBusTest, ToInterleavedPartial) {
339 // Only interleave the middle two frames in each channel.
340 static const int kPartialStart = 1;
341 static const int kPartialFrames = 2;
342 ASSERT_LE(kPartialStart + kPartialFrames, kTestVectorFrames);
343
344 scoped_ptr<AudioBus> expected = AudioBus::Create(
345 kTestVectorChannels, kTestVectorFrames);
346 for (int ch = 0; ch < kTestVectorChannels; ++ch) {
347 memcpy(expected->channel(ch), kTestVectorResult[ch],
348 kTestVectorFrames * sizeof(*expected->channel(ch)));
349 }
350
351 int16 test_array[arraysize(kTestVectorInt16)];
352 expected->ToInterleavedPartial(
353 kPartialStart, kPartialFrames, sizeof(*kTestVectorInt16), test_array);
354 ASSERT_EQ(memcmp(
355 test_array, kTestVectorInt16 + kPartialStart * kTestVectorChannels,
356 kPartialFrames * sizeof(*kTestVectorInt16)), 0);
357 }
358
337 } // namespace media 359 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_bus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698