OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <cmath> | 5 #include <cmath> |
6 #include <cstdint> | 6 #include <cstdint> |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "chromecast/media/cma/backend/alsa/post_processors/governor.h" | 14 #include "chromecast/media/cma/backend/alsa/post_processors/governor.h" |
15 #include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unitt est.h" | 15 #include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unitt est.h" |
16 #include "media/base/audio_bus.h" | |
17 #include "media/base/audio_sample_types.h" | |
18 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
19 | 17 |
20 namespace chromecast { | 18 namespace chromecast { |
21 namespace media { | 19 namespace media { |
22 namespace post_processor_test { | 20 namespace post_processor_test { |
23 | 21 |
24 namespace { | 22 namespace { |
25 | 23 |
26 const char* kConfigTemplate = | 24 const char* kConfigTemplate = |
27 R"config({"onset_volume": %f, "clamp_multiplier": %f})config"; | 25 R"config({"onset_volume": %f, "clamp_multiplier": %f})config"; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 ScaleData(expected_.data(), kNumFrames * kNumChannels, clamp_); | 102 ScaleData(expected_.data(), kNumFrames * kNumChannels, clamp_); |
105 } | 103 } |
106 CompareBuffers(); | 104 CompareBuffers(); |
107 } | 105 } |
108 | 106 |
109 INSTANTIATE_TEST_CASE_P(GovernorClampVolumeTest, | 107 INSTANTIATE_TEST_CASE_P(GovernorClampVolumeTest, |
110 GovernorTest, | 108 GovernorTest, |
111 ::testing::Values(0.0f, 0.1f, 0.5f, 0.9f, 1.0f, 1.1f)); | 109 ::testing::Values(0.0f, 0.1f, 0.5f, 0.9f, 1.0f, 1.1f)); |
112 | 110 |
113 // Default tests from post_processor_test | 111 // Default tests from post_processor_test |
114 TEST_P(PostProcessorTest, TestDelay) { | 112 TEST_P(PostProcessorTest, GovernorDelay) { |
115 std::string config = MakeConfigString(1.0, 1.0); | 113 std::string config = MakeConfigString(1.0, 1.0); |
116 auto pp = | 114 auto pp = |
117 base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels)); | 115 base::WrapUnique<AudioPostProcessor>(new Governor(config, kNumChannels)); |
kmackay
2017/07/06 22:16:28
Why not make this work the same way as saturated_g
bshaya
2017/07/06 22:38:10
Done.
| |
118 TestDelay(pp.get(), sample_rate_); | 116 TestDelay(pp.get(), sample_rate_); |
119 } | 117 } |
120 | 118 |
121 TEST_P(PostProcessorTest, TestRinging) { | 119 TEST_P(PostProcessorTest, GovernorRinging) { |
122 std::string config = MakeConfigString(1.0, 1.0); | 120 std::string config = MakeConfigString(1.0, 1.0); |
123 auto pp = | 121 auto pp = |
124 base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels)); | 122 base::WrapUnique<AudioPostProcessor>(new Governor(config, kNumChannels)); |
125 TestRingingTime(pp.get(), sample_rate_); | 123 TestRingingTime(pp.get(), sample_rate_); |
126 } | 124 } |
127 | 125 |
128 TEST_P(PostProcessorTest, TestPassthrough) { | 126 TEST_P(PostProcessorTest, GovernorPassthrough) { |
129 std::string config = MakeConfigString(1.0, 1.0); | 127 std::string config = MakeConfigString(1.0, 1.0); |
130 auto pp = | 128 auto pp = |
131 base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels)); | 129 base::WrapUnique<AudioPostProcessor>(new Governor(config, kNumChannels)); |
132 TestPassthrough(pp.get(), sample_rate_); | 130 TestPassthrough(pp.get(), sample_rate_); |
133 } | 131 } |
134 | 132 |
135 } // namespace post_processor_test | 133 } // namespace post_processor_test |
136 } // namespace media | 134 } // namespace media |
137 } // namespace chromecast | 135 } // namespace chromecast |
OLD | NEW |