Index: media/base/audio_bus_unittest.cc |
diff --git a/media/base/audio_bus_unittest.cc b/media/base/audio_bus_unittest.cc |
index dadb8e986e7ce9eaf8692aba263d19b25e7d2105..c3c60350822f12a4a53d0e7c36b08699361b2111 100644 |
--- a/media/base/audio_bus_unittest.cc |
+++ b/media/base/audio_bus_unittest.cc |
@@ -265,6 +265,9 @@ static const int32_t kTestVectorInt32[kTestVectorSize] = { |
INT32_MIN, 0, INT32_MAX, INT32_MIN, INT32_MAX / 2, |
INT32_MIN / 2, 0, INT32_MAX, 0, 0}; |
+static const float kTestVectorFloat[kTestVectorSize] = { |
+ -1.0, 0.0, 1.0, -1.0, 0.5, -0.5, 0.0, 1.0, 0.0, 0.0}; |
+ |
// Expected results. |
static const int kTestVectorFrames = kTestVectorSize / 2; |
static const float kTestVectorResult[][kTestVectorFrames] = { |
@@ -375,6 +378,24 @@ TEST_F(AudioBusTest, ToInterleaved) { |
} |
} |
+// Verify ToInterleavedFloat interleaves |AudioBus| channels of float |
+// into a single linear output buffer correctly |
mcasas
2016/04/11 23:47:08
s/ToInterleavedFloat/ToInterleavedFloat()/
Classe
|
+TEST_F(AudioBusTest, ToInterleavedFloat) { |
+ SCOPED_TRACE("float"); |
+ scoped_ptr<AudioBus> bus = |
+ AudioBus::Create(kTestVectorChannels, kTestVectorFrames); |
+ for (int ch = 0; ch < bus->channels(); ++ch) { |
+ memcpy(bus->channel(ch), kTestVectorResult[ch], |
+ kTestVectorFrames * sizeof(*bus->channel(ch))); |
+ } |
+ |
+ float test_array[arraysize(kTestVectorFloat)]; |
+ bus->ToInterleavedFloat(0, 0, bus->frames(), test_array); |
+ ASSERT_EQ(memcmp(test_array, kTestVectorFloat, |
eklavyamirani
2016/04/04 08:11:58
Fixed the formatting on this in my local commit. A
mcasas
2016/04/11 23:47:08
Sorry, yes, when you have addressed the
reviewers'
|
+ kTestVectorFrames * sizeof(*kTestVectorFloat)), |
+ 0); |
+} |
+ |
// Verify ToInterleavedPartial() interleaves audio correctly. |
TEST_F(AudioBusTest, ToInterleavedPartial) { |
// Only interleave the middle two frames in each channel. |