OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <string> |
| 6 #include <vector> |
| 7 |
| 8 #include "base/strings/stringprintf.h" |
| 9 #include "chromecast/media/cma/backend/alsa/post_processor_factory.h" |
| 10 #include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unitt
est.h" |
| 11 |
| 12 namespace chromecast { |
| 13 namespace media { |
| 14 namespace post_processor_test { |
| 15 |
| 16 namespace { |
| 17 |
| 18 const char kConfigTemplate[] = |
| 19 R"config({"gain_db": %f})config"; |
| 20 |
| 21 const char kLibraryPath[] = "libcast_saturated_gain_1.0.so"; |
| 22 |
| 23 std::string MakeConfigString(float gain_db) { |
| 24 return base::StringPrintf(kConfigTemplate, gain_db); |
| 25 } |
| 26 |
| 27 } // namespace |
| 28 |
| 29 // Default tests from post_processor_test |
| 30 TEST_P(PostProcessorTest, SaturatedGainDelay) { |
| 31 PostProcessorFactory factory; |
| 32 std::string config = MakeConfigString(0.0); |
| 33 auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels); |
| 34 TestDelay(pp.get(), sample_rate_); |
| 35 } |
| 36 |
| 37 TEST_P(PostProcessorTest, SaturatedGainRinging) { |
| 38 PostProcessorFactory factory; |
| 39 std::string config = MakeConfigString(0.0); |
| 40 auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels); |
| 41 TestRingingTime(pp.get(), sample_rate_); |
| 42 } |
| 43 |
| 44 // Also tests clipping (by attempting to set gain way too high). |
| 45 TEST_P(PostProcessorTest, SaturatedGainPassthrough) { |
| 46 PostProcessorFactory factory; |
| 47 std::string config = MakeConfigString(100.0); |
| 48 auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels); |
| 49 TestPassthrough(pp.get(), sample_rate_); |
| 50 } |
| 51 |
| 52 } // namespace post_processor_test |
| 53 } // namespace media |
| 54 } // namespace chromecast |
OLD | NEW |