OLD | NEW |
---|---|
(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 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" | |
12 | |
13 #include "webrtc/base/checks.h" | |
14 #include "webrtc/modules/audio_processing/include/audio_processing.h" | |
15 | |
16 namespace webrtc { | |
17 | |
18 GainControlForExperimentalAgc::GainControlForExperimentalAgc( | |
19 GainControl* gain_control) | |
20 : real_gain_control_(gain_control), volume_(0) { | |
21 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
| |
22 } | |
23 | |
24 int GainControlForExperimentalAgc::Enable(bool enable) { | |
25 return real_gain_control_->Enable(enable); | |
26 } | |
27 | |
28 bool GainControlForExperimentalAgc::is_enabled() const { | |
29 return real_gain_control_->is_enabled(); | |
30 } | |
31 | |
32 int GainControlForExperimentalAgc::set_stream_analog_level(int level) { | |
33 RTC_CHECK(thread_checker.CalledOnValidThread()); | |
34 volume_ = level; | |
35 return AudioProcessing::kNoError; | |
36 } | |
37 | |
38 int GainControlForExperimentalAgc::stream_analog_level() { | |
39 RTC_CHECK(thread_checker.CalledOnValidThread()); | |
the sun
2016/02/09 11:49:55
Thank you!
| |
40 return volume_; | |
41 } | |
42 | |
43 int GainControlForExperimentalAgc::set_mode(Mode mode) { | |
44 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
| |
45 } | |
46 | |
47 GainControl::Mode GainControlForExperimentalAgc::mode() const { | |
48 return GainControl::kAdaptiveAnalog; | |
49 } | |
50 | |
51 int GainControlForExperimentalAgc::set_target_level_dbfs(int level) { | |
52 return AudioProcessing::kNoError; | |
53 } | |
54 | |
55 int GainControlForExperimentalAgc::target_level_dbfs() const { | |
56 return real_gain_control_->target_level_dbfs(); | |
57 } | |
58 | |
59 int GainControlForExperimentalAgc::set_compression_gain_db(int gain) { | |
60 return AudioProcessing::kNoError; | |
61 } | |
62 | |
63 int GainControlForExperimentalAgc::compression_gain_db() const { | |
64 return real_gain_control_->compression_gain_db(); | |
65 } | |
66 | |
67 int GainControlForExperimentalAgc::enable_limiter(bool enable) { | |
68 return AudioProcessing::kNoError; | |
69 } | |
70 | |
71 bool GainControlForExperimentalAgc::is_limiter_enabled() const { | |
72 return real_gain_control_->is_limiter_enabled(); | |
73 } | |
74 | |
75 int GainControlForExperimentalAgc::set_analog_level_limits(int minimum, | |
76 int maximum) { | |
77 return AudioProcessing::kNoError; | |
78 } | |
79 | |
80 int GainControlForExperimentalAgc::analog_level_minimum() const { | |
81 return real_gain_control_->analog_level_minimum(); | |
82 } | |
83 | |
84 int GainControlForExperimentalAgc::analog_level_maximum() const { | |
85 return real_gain_control_->analog_level_maximum(); | |
86 } | |
87 | |
88 bool GainControlForExperimentalAgc::stream_is_saturated() const { | |
89 return real_gain_control_->stream_is_saturated(); | |
90 } | |
91 | |
92 void GainControlForExperimentalAgc::SetMicVolume(int volume) { | |
93 RTC_CHECK(thread_checker.CalledOnValidThread()); | |
94 volume_ = volume; | |
95 } | |
96 | |
97 int GainControlForExperimentalAgc::GetMicVolume() { | |
98 RTC_CHECK(thread_checker.CalledOnValidThread()); | |
99 return volume_; | |
100 } | |
101 | |
102 } // namespace webrtc | |
OLD | NEW |