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

Unified Diff: webrtc/modules/audio_processing/gain_control_for_experimental_agc.cc

Issue 1678813002: Moved the GainControlForNewAGC class to a separate file. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changed the locking test to match how the gain control is used in practice and to comply with the n… Created 4 years, 10 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: webrtc/modules/audio_processing/gain_control_for_experimental_agc.cc
diff --git a/webrtc/modules/audio_processing/gain_control_for_experimental_agc.cc b/webrtc/modules/audio_processing/gain_control_for_experimental_agc.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fedbbbad95b8a40f954397b46bef115e2cd2e344
--- /dev/null
+++ b/webrtc/modules/audio_processing/gain_control_for_experimental_agc.cc
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h"
+
+#include "webrtc/base/checks.h"
+#include "webrtc/modules/audio_processing/include/audio_processing.h"
+
+namespace webrtc {
+
+GainControlForExperimentalAgc::GainControlForExperimentalAgc(
+ GainControl* gain_control)
+ : real_gain_control_(gain_control), volume_(0) {
+ thread_checker.DetachFromThread();
the sun 2016/02/09 11:49:55 Really needed?
peah-webrtc 2016/02/10 09:33:37 With the current locking test, it will require qui
+}
+
+int GainControlForExperimentalAgc::Enable(bool enable) {
+ return real_gain_control_->Enable(enable);
+}
+
+bool GainControlForExperimentalAgc::is_enabled() const {
+ return real_gain_control_->is_enabled();
+}
+
+int GainControlForExperimentalAgc::set_stream_analog_level(int level) {
+ RTC_CHECK(thread_checker.CalledOnValidThread());
+ volume_ = level;
+ return AudioProcessing::kNoError;
+}
+
+int GainControlForExperimentalAgc::stream_analog_level() {
+ RTC_CHECK(thread_checker.CalledOnValidThread());
the sun 2016/02/09 11:49:55 Thank you!
+ return volume_;
+}
+
+int GainControlForExperimentalAgc::set_mode(Mode mode) {
+ return AudioProcessing::kNoError;
the sun 2016/02/09 11:49:55 (Not possible to add TCs to the other methods?)
peah-webrtc 2016/02/10 09:33:37 I tried and it is a bit tricky as it requires the
+}
+
+GainControl::Mode GainControlForExperimentalAgc::mode() const {
+ return GainControl::kAdaptiveAnalog;
+}
+
+int GainControlForExperimentalAgc::set_target_level_dbfs(int level) {
+ return AudioProcessing::kNoError;
+}
+
+int GainControlForExperimentalAgc::target_level_dbfs() const {
+ return real_gain_control_->target_level_dbfs();
+}
+
+int GainControlForExperimentalAgc::set_compression_gain_db(int gain) {
+ return AudioProcessing::kNoError;
+}
+
+int GainControlForExperimentalAgc::compression_gain_db() const {
+ return real_gain_control_->compression_gain_db();
+}
+
+int GainControlForExperimentalAgc::enable_limiter(bool enable) {
+ return AudioProcessing::kNoError;
+}
+
+bool GainControlForExperimentalAgc::is_limiter_enabled() const {
+ return real_gain_control_->is_limiter_enabled();
+}
+
+int GainControlForExperimentalAgc::set_analog_level_limits(int minimum,
+ int maximum) {
+ return AudioProcessing::kNoError;
+}
+
+int GainControlForExperimentalAgc::analog_level_minimum() const {
+ return real_gain_control_->analog_level_minimum();
+}
+
+int GainControlForExperimentalAgc::analog_level_maximum() const {
+ return real_gain_control_->analog_level_maximum();
+}
+
+bool GainControlForExperimentalAgc::stream_is_saturated() const {
+ return real_gain_control_->stream_is_saturated();
+}
+
+void GainControlForExperimentalAgc::SetMicVolume(int volume) {
+ RTC_CHECK(thread_checker.CalledOnValidThread());
+ volume_ = volume;
+}
+
+int GainControlForExperimentalAgc::GetMicVolume() {
+ RTC_CHECK(thread_checker.CalledOnValidThread());
+ return volume_;
+}
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698