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

Unified Diff: chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h

Issue 2860673003: [Chromecast] Correct libcast_governor behavior. (Closed)
Patch Set: bcf's comments pt 2: Electric Boogaloo Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h
diff --git a/chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h b/chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h
new file mode 100644
index 0000000000000000000000000000000000000000..baeec455ee9afd444cad0b6dfb33853b750c01ea
--- /dev/null
+++ b/chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h
@@ -0,0 +1,54 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_
+#define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_
+
+#include <memory>
+#include <vector>
+
+#include "base/macros.h"
+#include "chromecast/media/cma/backend/alsa/slew_volume.h"
+#include "chromecast/public/media/audio_post_processor_shlib.h"
+
+namespace chromecast {
+namespace media {
+
+// Provides a flat reduction in output volume if the input volume is above a
+// given threshold.
+// Used to protect speakers at high output levels
+// while providing dyanmic range at low output level.
kmackay 2017/05/04 18:29:34 Fix formatting and typo.
bshaya 2017/05/04 23:53:38 Done.
+// The configuration string for this plugin is:
+// {"onset_volume": |VOLUME_TO_CLAMP|, "clamp_multiplier": |CLAMP_MULTIPLIER|}
+// Input volumes > |VOLUME_TO_CLAMP| will be attenuated by |CLAMP_MULTIPLIER|.
+class Governor : public AudioPostProcessor {
+ public:
+ Governor(const std::string& config, int channels);
+ ~Governor() override;
+
+ // AudioPostProcessor implementations:
kmackay 2017/05/04 18:29:34 implementation:
bshaya 2017/05/04 23:53:38 Done.
+ bool SetSampleRate(int sample_rate) override;
+ int ProcessFrames(const std::vector<float*>& data,
+ int frames,
+ float volume) override;
+ int GetRingingTimeInFrames() override;
+
+ void SetSlewTimeMsForTest(int slew_time_ms);
+
+ private:
+ float GetGovernorMultiplier();
+
+ int channels_;
+ int sample_rate_;
+ float volume_;
+ double onset_volume_;
+ double clamp_multiplier_;
+ SlewVolume slew_volume_;
kmackay 2017/05/04 18:29:34 add blank line before DISALLOW...
bshaya 2017/05/04 23:53:38 Done.
+ DISALLOW_COPY_AND_ASSIGN(Governor);
+};
+
+} // namespace media
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_

Powered by Google App Engine
This is Rietveld 408576698