Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chromecast/media/cma/backend/alsa/post_processors/saturated_gain_unittest.cc

Issue 2958393002: Add a simple, safe gain PostProcessor. (Closed)
Patch Set: Move cast_audio.json filepath string to a separate file Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/memory/ptr_util.h"
9 #include "base/strings/stringprintf.h"
10 #include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unitt est.h"
11 #include "chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h"
12
13 namespace chromecast {
14 namespace media {
15 namespace post_processor_test {
16
17 namespace {
18
19 const char* kConfigTemplate =
20 R"config({"gain_db": %f})config";
21
22 std::string MakeConfigString(float gain_db) {
23 return base::StringPrintf(kConfigTemplate, gain_db);
24 }
25
26 } // namespace
27
28 // Default tests from post_processor_test
29 TEST_P(PostProcessorTest, TestDelay) {
30 std::string config = MakeConfigString(0.0);
31 auto pp =
32 base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels));
33 TestDelay(pp.get(), sample_rate_);
34 }
35
36 TEST_P(PostProcessorTest, TestRinging) {
37 std::string config = MakeConfigString(0.0);
38 auto pp =
39 base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels));
40 TestRingingTime(pp.get(), sample_rate_);
41 }
42
43 // Also tests clipping (by attempting to set gain way too high).
44 TEST_P(PostProcessorTest, TestPassthrough) {
45 std::string config = MakeConfigString(100.0);
46 auto pp =
47 base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels));
48 TestPassthrough(pp.get(), sample_rate_);
49 }
50
51 } // namespace post_processor_test
52 } // namespace media
53 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698