OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 LOG(LS_ERROR) << "Failed to set compression gain: " | 38 LOG(LS_ERROR) << "Failed to set compression gain: " |
39 << config.digitalCompressionGaindB; | 39 << config.digitalCompressionGaindB; |
40 } | 40 } |
41 if (gc->enable_limiter(config.limiterEnable) != 0) { | 41 if (gc->enable_limiter(config.limiterEnable) != 0) { |
42 LOG(LS_ERROR) << "Failed to set limiter on/off: " << config.limiterEnable; | 42 LOG(LS_ERROR) << "Failed to set limiter on/off: " << config.limiterEnable; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 void SetAgcStatus(AudioProcessing* apm, | 46 void SetAgcStatus(AudioProcessing* apm, |
47 AudioDeviceModule* adm, | 47 AudioDeviceModule* adm, |
48 bool enable, | 48 bool enable) { |
49 AgcModes mode) { | |
50 RTC_DCHECK(apm); | 49 RTC_DCHECK(apm); |
51 RTC_DCHECK(adm); | 50 RTC_DCHECK(adm); |
52 #if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID) | 51 #if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID) |
53 RTC_DCHECK_EQ(kAgcFixedDigital, mode); | |
54 GainControl::Mode agc_mode = GainControl::kFixedDigital; | 52 GainControl::Mode agc_mode = GainControl::kFixedDigital; |
55 #else | 53 #else |
56 RTC_DCHECK_EQ(kAgcAdaptiveAnalog, mode); | |
57 GainControl::Mode agc_mode = GainControl::kAdaptiveAnalog; | 54 GainControl::Mode agc_mode = GainControl::kAdaptiveAnalog; |
58 #endif | 55 #endif |
59 GainControl* gc = apm->gain_control(); | 56 GainControl* gc = apm->gain_control(); |
60 if (gc->set_mode(agc_mode) != 0) { | 57 if (gc->set_mode(agc_mode) != 0) { |
61 LOG(LS_ERROR) << "Failed to set AGC mode: " << agc_mode; | 58 LOG(LS_ERROR) << "Failed to set AGC mode: " << agc_mode; |
62 return; | 59 return; |
63 } | 60 } |
64 if (gc->Enable(enable) != 0) { | 61 if (gc->Enable(enable) != 0) { |
65 LOG(LS_ERROR) << "Failed to enable/disable AGC: " << enable; | 62 LOG(LS_ERROR) << "Failed to enable/disable AGC: " << enable; |
66 return; | 63 return; |
67 } | 64 } |
68 // Set AGC state in the ADM when adaptive AGC mode has been selected. | 65 // Set AGC state in the ADM when adaptive AGC mode has been selected. |
69 if (adm->SetAGC(enable && agc_mode == GainControl::kAdaptiveAnalog) != 0) { | 66 if (adm->SetAGC(enable && agc_mode == GainControl::kAdaptiveAnalog) != 0) { |
70 LOG(LS_ERROR) << "Failed to set AGC mode in ADM: " << enable; | 67 LOG(LS_ERROR) << "Failed to set AGC mode in ADM: " << enable; |
71 return; | 68 return; |
72 } | 69 } |
73 LOG(LS_INFO) << "AGC set to " << enable << " with mode " << mode; | 70 LOG(LS_INFO) << "AGC set to " << enable << " with mode " << agc_mode; |
74 } | 71 } |
75 | 72 |
76 void SetEcStatus(AudioProcessing* apm, | 73 void SetEcStatus(AudioProcessing* apm, |
77 bool enable, | 74 bool enable, |
78 EcModes mode) { | 75 EcModes mode) { |
79 RTC_DCHECK(apm); | 76 RTC_DCHECK(apm); |
80 RTC_DCHECK(mode == kEcConference || mode == kEcAecm) << "mode: " << mode; | 77 RTC_DCHECK(mode == kEcConference || mode == kEcAecm) << "mode: " << mode; |
81 EchoCancellation* ec = apm->echo_cancellation(); | 78 EchoCancellation* ec = apm->echo_cancellation(); |
82 EchoControlMobile* ecm = apm->echo_control_mobile(); | 79 EchoControlMobile* ecm = apm->echo_control_mobile(); |
83 if (mode == kEcConference) { | 80 if (mode == kEcConference) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 161 } |
165 if (vd->set_likelihood(VoiceDetection::kVeryLowLikelihood)) { | 162 if (vd->set_likelihood(VoiceDetection::kVeryLowLikelihood)) { |
166 LOG(LS_ERROR) << "Failed to set low VAD likelihood."; | 163 LOG(LS_ERROR) << "Failed to set low VAD likelihood."; |
167 return; | 164 return; |
168 } | 165 } |
169 LOG(LS_INFO) << "VAD set to " << enable << " for typing detection."; | 166 LOG(LS_INFO) << "VAD set to " << enable << " for typing detection."; |
170 #endif | 167 #endif |
171 } | 168 } |
172 } // namespace apm_helpers | 169 } // namespace apm_helpers |
173 } // namespace webrtc | 170 } // namespace webrtc |
OLD | NEW |