OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 LOG(LS_INFO) << "[agc] rms_error=" << rms_error << ", " | 404 LOG(LS_INFO) << "[agc] rms_error=" << rms_error << ", " |
405 << "target_compression=" << target_compression_ << ", " | 405 << "target_compression=" << target_compression_ << ", " |
406 << "residual_gain=" << residual_gain; | 406 << "residual_gain=" << residual_gain; |
407 if (residual_gain == 0) | 407 if (residual_gain == 0) |
408 return; | 408 return; |
409 | 409 |
410 int old_level = level_; | 410 int old_level = level_; |
411 SetLevel(LevelFromGainError(residual_gain, level_)); | 411 SetLevel(LevelFromGainError(residual_gain, level_)); |
412 if (old_level != level_) { | 412 if (old_level != level_) { |
413 // level_ was updated by SetLevel; log the new value. | 413 // level_ was updated by SetLevel; log the new value. |
414 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.AgcSetLevel", level_, 1, | 414 RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.AgcLevel", level_, kMaxMicLevel); |
415 kMaxMicLevel, 50); | |
416 } | 415 } |
417 } | 416 } |
418 | 417 |
419 void AgcManagerDirect::UpdateCompressor() { | 418 void AgcManagerDirect::UpdateCompressor() { |
420 if (compression_ == target_compression_) { | 419 if (compression_ == target_compression_) { |
421 return; | 420 return; |
422 } | 421 } |
423 | 422 |
424 // Adapt the compression gain slowly towards the target, in order to avoid | 423 // Adapt the compression gain slowly towards the target, in order to avoid |
425 // highly perceptible changes. | 424 // highly perceptible changes. |
(...skipping 18 matching lines...) Expand all Loading... |
444 compression_ = new_compression; | 443 compression_ = new_compression; |
445 compression_accumulator_ = new_compression; | 444 compression_accumulator_ = new_compression; |
446 if (gctrl_->set_compression_gain_db(compression_) != 0) { | 445 if (gctrl_->set_compression_gain_db(compression_) != 0) { |
447 LOG(LS_ERROR) << "set_compression_gain_db(" << compression_ | 446 LOG(LS_ERROR) << "set_compression_gain_db(" << compression_ |
448 << ") failed."; | 447 << ") failed."; |
449 } | 448 } |
450 } | 449 } |
451 } | 450 } |
452 | 451 |
453 } // namespace webrtc | 452 } // namespace webrtc |
OLD | NEW |