OLD | NEW |
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return AudioProcessing::kBadParameterError; | 289 return AudioProcessing::kBadParameterError; |
290 } | 290 } |
291 analog_capture_level_ = level; | 291 analog_capture_level_ = level; |
292 | 292 |
293 return AudioProcessing::kNoError; | 293 return AudioProcessing::kNoError; |
294 } | 294 } |
295 | 295 |
296 int GainControlImpl::stream_analog_level() { | 296 int GainControlImpl::stream_analog_level() { |
297 rtc::CritScope cs(crit_capture_); | 297 rtc::CritScope cs(crit_capture_); |
298 // TODO(ajm): enable this assertion? | 298 // TODO(ajm): enable this assertion? |
299 //assert(mode_ == kAdaptiveAnalog); | 299 //RTC_DCHECK_EQ(kAdaptiveAnalog, mode_); |
300 | 300 |
301 return analog_capture_level_; | 301 return analog_capture_level_; |
302 } | 302 } |
303 | 303 |
304 int GainControlImpl::Enable(bool enable) { | 304 int GainControlImpl::Enable(bool enable) { |
305 rtc::CritScope cs_render(crit_render_); | 305 rtc::CritScope cs_render(crit_render_); |
306 rtc::CritScope cs_capture(crit_capture_); | 306 rtc::CritScope cs_capture(crit_capture_); |
307 if (enable && !enabled_) { | 307 if (enable && !enabled_) { |
308 enabled_ = enable; // Must be set before Initialize() is called. | 308 enabled_ = enable; // Must be set before Initialize() is called. |
309 | 309 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 render_signal_queue_->Clear(); | 475 render_signal_queue_->Clear(); |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 int GainControlImpl::Configure() { | 479 int GainControlImpl::Configure() { |
480 rtc::CritScope cs_render(crit_render_); | 480 rtc::CritScope cs_render(crit_render_); |
481 rtc::CritScope cs_capture(crit_capture_); | 481 rtc::CritScope cs_capture(crit_capture_); |
482 WebRtcAgcConfig config; | 482 WebRtcAgcConfig config; |
483 // TODO(ajm): Flip the sign here (since AGC expects a positive value) if we | 483 // TODO(ajm): Flip the sign here (since AGC expects a positive value) if we |
484 // change the interface. | 484 // change the interface. |
485 //assert(target_level_dbfs_ <= 0); | 485 //RTC_DCHECK_LE(target_level_dbfs_, 0); |
486 //config.targetLevelDbfs = static_cast<int16_t>(-target_level_dbfs_); | 486 //config.targetLevelDbfs = static_cast<int16_t>(-target_level_dbfs_); |
487 config.targetLevelDbfs = static_cast<int16_t>(target_level_dbfs_); | 487 config.targetLevelDbfs = static_cast<int16_t>(target_level_dbfs_); |
488 config.compressionGaindB = | 488 config.compressionGaindB = |
489 static_cast<int16_t>(compression_gain_db_); | 489 static_cast<int16_t>(compression_gain_db_); |
490 config.limiterEnable = limiter_enabled_; | 490 config.limiterEnable = limiter_enabled_; |
491 | 491 |
492 int error = AudioProcessing::kNoError; | 492 int error = AudioProcessing::kNoError; |
493 for (auto& gain_controller : gain_controllers_) { | 493 for (auto& gain_controller : gain_controllers_) { |
494 const int handle_error = | 494 const int handle_error = |
495 WebRtcAgc_set_config(gain_controller->state(), config); | 495 WebRtcAgc_set_config(gain_controller->state(), config); |
496 if (handle_error != AudioProcessing::kNoError) { | 496 if (handle_error != AudioProcessing::kNoError) { |
497 error = handle_error; | 497 error = handle_error; |
498 } | 498 } |
499 } | 499 } |
500 return error; | 500 return error; |
501 } | 501 } |
502 } // namespace webrtc | 502 } // namespace webrtc |
OLD | NEW |