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

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

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

Powered by Google App Engine
This is Rietveld 408576698