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

Side by Side Diff: webrtc/modules/audio_processing/gain_control_for_experimental_agc.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_FOR_EXPERIMENTAL_AGC_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_FOR_EXPERIMENTAL_AGC_H_
13
14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/base/thread_checker.h"
16 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h"
17 #include "webrtc/modules/audio_processing/include/audio_processing.h"
18
19 namespace webrtc {
20
21 // This class has two main purposes:
22 //
23 // 1) It is returned instead of the real GainControl after the new AGC has been
24 // enabled in order to prevent an outside user from overriding compression
25 // settings. It doesn't do anything in its implementation, except for
26 // delegating the const methods and Enable calls to the real GainControl, so
27 // AGC can still be disabled.
28 //
29 // 2) It is injected into AgcManagerDirect and implements volume callbacks for
30 // getting and setting the volume level. It just caches this value to be used
31 // in VoiceEngine later.
32 class GainControlForExperimentalAgc : public GainControl,
33 public VolumeCallbacks {
34 public:
35 explicit GainControlForExperimentalAgc(GainControl* gain_control);
36
37 // GainControl implementation.
38 int Enable(bool enable) override;
39 bool is_enabled() const override;
40 int set_stream_analog_level(int level) override;
41 int stream_analog_level() override;
42 int set_mode(Mode mode) override;
43 Mode mode() const override;
44 int set_target_level_dbfs(int level) override;
45 int target_level_dbfs() const override;
46 int set_compression_gain_db(int gain) override;
47 int compression_gain_db() const override;
48 int enable_limiter(bool enable) override;
49 bool is_limiter_enabled() const override;
50 int set_analog_level_limits(int minimum, int maximum) override;
51 int analog_level_minimum() const override;
52 int analog_level_maximum() const override;
53 bool stream_is_saturated() const override;
54
55 // VolumeCallbacks implementation.
56 void SetMicVolume(int volume) override;
57 int GetMicVolume() override;
58
59 private:
60 GainControl* real_gain_control_;
61 int volume_;
62 rtc::ThreadChecker thread_checker;
63
64 RTC_DISALLOW_COPY_AND_ASSIGN(GainControlForExperimentalAgc);
65 };
66
67 } // namespace webrtc
68
69 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_FOR_EXPERIMENTAL_AGC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698