OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/base/audio_buffer.h" | 5 #include "media/base/audio_buffer.h" |
6 #include "media/base/audio_bus.h" | 6 #include "media/base/audio_bus.h" |
7 #include "media/base/test_helpers.h" | 7 #include "media/base/test_helpers.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 scoped_refptr<AudioBuffer> buffer = | 195 scoped_refptr<AudioBuffer> buffer = |
196 AudioBuffer::CopyFrom(kSampleFormatU8, | 196 AudioBuffer::CopyFrom(kSampleFormatU8, |
197 CHANNEL_LAYOUT_STEREO, | 197 CHANNEL_LAYOUT_STEREO, |
198 2, | 198 2, |
199 kSampleRate, | 199 kSampleRate, |
200 16, | 200 16, |
201 data, | 201 data, |
202 kTimestamp); | 202 kTimestamp); |
203 EXPECT_EQ(16, buffer->frame_count()); // 2 channels of 8-bit data | 203 EXPECT_EQ(16, buffer->frame_count()); // 2 channels of 8-bit data |
204 | 204 |
205 buffer = AudioBuffer::CopyFrom(kSampleFormatF32, | 205 buffer = AudioBuffer::CopyFrom(kSampleFormatF32, CHANNEL_LAYOUT_4_0, 4, |
206 CHANNEL_LAYOUT_4_0, | 206 kSampleRate, 2, data, kTimestamp); |
207 4, | |
208 kSampleRate, | |
209 2, | |
210 data, | |
211 kTimestamp); | |
212 EXPECT_EQ(2, buffer->frame_count()); // now 4 channels of 32-bit data | 207 EXPECT_EQ(2, buffer->frame_count()); // now 4 channels of 32-bit data |
213 } | 208 } |
214 | 209 |
215 TEST(AudioBufferTest, ReadU8) { | 210 TEST(AudioBufferTest, ReadU8) { |
216 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; | 211 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; |
217 const int channels = ChannelLayoutToChannelCount(channel_layout); | 212 const int channels = ChannelLayoutToChannelCount(channel_layout); |
218 const int frames = 10; | 213 const int frames = 10; |
219 const base::TimeDelta start_time; | 214 const base::TimeDelta start_time; |
220 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8>(kSampleFormatU8, | 215 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8>(kSampleFormatU8, |
221 channel_layout, | 216 channel_layout, |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 579 |
585 TEST(AudioBufferTest, ReadFramesInterleavedS16FromPlanarS16) { | 580 TEST(AudioBufferTest, ReadFramesInterleavedS16FromPlanarS16) { |
586 ReadFramesInterleavedS16Test(kSampleFormatPlanarS16); | 581 ReadFramesInterleavedS16Test(kSampleFormatPlanarS16); |
587 } | 582 } |
588 | 583 |
589 TEST(AudioBufferTest, ReadFramesInterleavedS16FromPlanarF32) { | 584 TEST(AudioBufferTest, ReadFramesInterleavedS16FromPlanarF32) { |
590 ReadFramesInterleavedS16Test(kSampleFormatPlanarF32); | 585 ReadFramesInterleavedS16Test(kSampleFormatPlanarF32); |
591 } | 586 } |
592 | 587 |
593 } // namespace media | 588 } // namespace media |
OLD | NEW |