OLD | NEW |
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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "media/audio/audio_parameters.h" | 8 #include "media/audio/audio_parameters.h" |
9 #include "media/base/audio_bus.h" | 9 #include "media/base/audio_bus.h" |
10 #include "media/base/channel_layout.h" | 10 #include "media/base/channel_layout.h" |
11 #include "media/base/fake_audio_render_callback.h" | 11 #include "media/base/fake_audio_render_callback.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 static const int kChannels = 6; | 16 static const int kChannels = 6; |
17 static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_5_1; | 17 static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_5_1; |
18 // Use a buffer size which is intentionally not a multiple of kChannelAlignment. | 18 // Use a buffer size which is intentionally not a multiple of kChannelAlignment. |
19 static const int kFrameCount = media::AudioBus::kChannelAlignment * 32 - 1; | 19 static const int kFrameCount = media::AudioBus::kChannelAlignment * 32 - 1; |
20 static const int kSampleRate = 48000; | 20 static const int kSampleRate = 48000; |
21 | 21 |
22 class AudioBusTest : public testing::Test { | 22 class AudioBusTest : public testing::Test { |
23 public: | 23 public: |
24 AudioBusTest() {} | 24 AudioBusTest() {} |
25 virtual ~AudioBusTest() { | 25 ~AudioBusTest() override { |
26 for (size_t i = 0; i < data_.size(); ++i) | 26 for (size_t i = 0; i < data_.size(); ++i) |
27 base::AlignedFree(data_[i]); | 27 base::AlignedFree(data_[i]); |
28 } | 28 } |
29 | 29 |
30 // Validate parameters returned by AudioBus v.s. the constructed parameters. | 30 // Validate parameters returned by AudioBus v.s. the constructed parameters. |
31 void VerifyParams(AudioBus* bus) { | 31 void VerifyParams(AudioBus* bus) { |
32 EXPECT_EQ(kChannels, bus->channels()); | 32 EXPECT_EQ(kChannels, bus->channels()); |
33 EXPECT_EQ(kFrameCount, bus->frames()); | 33 EXPECT_EQ(kFrameCount, bus->frames()); |
34 } | 34 } |
35 | 35 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 // Verify zero volume case. | 408 // Verify zero volume case. |
409 bus->Scale(0); | 409 bus->Scale(0); |
410 for (int i = 0; i < bus->channels(); ++i) { | 410 for (int i = 0; i < bus->channels(); ++i) { |
411 SCOPED_TRACE("Zero Scale"); | 411 SCOPED_TRACE("Zero Scale"); |
412 VerifyValue(bus->channel(i), bus->frames(), 0); | 412 VerifyValue(bus->channel(i), bus->frames(), 0); |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 } // namespace media | 416 } // namespace media |
OLD | NEW |