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

Side by Side Diff: webrtc/modules/audio_processing/gain_control_impl.cc

Issue 1913603002: Compensate for the compression gain in the IntelligibilityEnhancer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Naming Created 4 years, 7 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
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 analog_capture_level_ += gain_controller->get_capture_level(); 267 analog_capture_level_ += gain_controller->get_capture_level();
268 } 268 }
269 269
270 analog_capture_level_ /= (*num_proc_channels_); 270 analog_capture_level_ /= (*num_proc_channels_);
271 } 271 }
272 272
273 was_analog_level_set_ = false; 273 was_analog_level_set_ = false;
274 return AudioProcessing::kNoError; 274 return AudioProcessing::kNoError;
275 } 275 }
276 276
277 int GainControlImpl::compression_gain_db() const {
278 rtc::CritScope cs(crit_capture_);
279 return compression_gain_db_;
280 }
281
277 // TODO(ajm): ensure this is called under kAdaptiveAnalog. 282 // TODO(ajm): ensure this is called under kAdaptiveAnalog.
278 int GainControlImpl::set_stream_analog_level(int level) { 283 int GainControlImpl::set_stream_analog_level(int level) {
279 rtc::CritScope cs(crit_capture_); 284 rtc::CritScope cs(crit_capture_);
280 285
281 was_analog_level_set_ = true; 286 was_analog_level_set_ = true;
282 if (level < minimum_capture_level_ || level > maximum_capture_level_) { 287 if (level < minimum_capture_level_ || level > maximum_capture_level_) {
283 return AudioProcessing::kBadParameterError; 288 return AudioProcessing::kBadParameterError;
284 } 289 }
285 analog_capture_level_ = level; 290 analog_capture_level_ = level;
286 291
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (gain < 0 || gain > 90) { 411 if (gain < 0 || gain > 90) {
407 return AudioProcessing::kBadParameterError; 412 return AudioProcessing::kBadParameterError;
408 } 413 }
409 { 414 {
410 rtc::CritScope cs(crit_capture_); 415 rtc::CritScope cs(crit_capture_);
411 compression_gain_db_ = gain; 416 compression_gain_db_ = gain;
412 } 417 }
413 return Configure(); 418 return Configure();
414 } 419 }
415 420
416 int GainControlImpl::compression_gain_db() const {
417 rtc::CritScope cs(crit_capture_);
418 return compression_gain_db_;
419 }
420
421 int GainControlImpl::enable_limiter(bool enable) { 421 int GainControlImpl::enable_limiter(bool enable) {
422 { 422 {
423 rtc::CritScope cs(crit_capture_); 423 rtc::CritScope cs(crit_capture_);
424 limiter_enabled_ = enable; 424 limiter_enabled_ = enable;
425 } 425 }
426 return Configure(); 426 return Configure();
427 } 427 }
428 428
429 bool GainControlImpl::is_limiter_enabled() const { 429 bool GainControlImpl::is_limiter_enabled() const {
430 rtc::CritScope cs(crit_capture_); 430 rtc::CritScope cs(crit_capture_);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 for (auto& gain_controller : gain_controllers_) { 498 for (auto& gain_controller : gain_controllers_) {
499 const int handle_error = 499 const int handle_error =
500 WebRtcAgc_set_config(gain_controller->state(), config); 500 WebRtcAgc_set_config(gain_controller->state(), config);
501 if (handle_error != AudioProcessing::kNoError) { 501 if (handle_error != AudioProcessing::kNoError) {
502 error = handle_error; 502 error = handle_error;
503 } 503 }
504 } 504 }
505 return error; 505 return error;
506 } 506 }
507 } // namespace webrtc 507 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698