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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 return AudioProcessing::kNoError; | 329 return AudioProcessing::kNoError; |
330 } | 330 } |
331 | 331 |
332 GainControl::Mode GainControlImpl::mode() const { | 332 GainControl::Mode GainControlImpl::mode() const { |
333 rtc::CritScope cs(crit_capture_); | 333 rtc::CritScope cs(crit_capture_); |
334 return mode_; | 334 return mode_; |
335 } | 335 } |
336 | 336 |
337 int GainControlImpl::set_analog_level_limits(int minimum, | 337 int GainControlImpl::set_analog_level_limits(int minimum, |
338 int maximum) { | 338 int maximum) { |
339 rtc::CritScope cs(crit_capture_); | |
340 if (minimum < 0) { | 339 if (minimum < 0) { |
341 return AudioProcessing::kBadParameterError; | 340 return AudioProcessing::kBadParameterError; |
342 } | 341 } |
343 | 342 |
344 if (maximum > 65535) { | 343 if (maximum > 65535) { |
345 return AudioProcessing::kBadParameterError; | 344 return AudioProcessing::kBadParameterError; |
346 } | 345 } |
347 | 346 |
348 if (maximum < minimum) { | 347 if (maximum < minimum) { |
349 return AudioProcessing::kBadParameterError; | 348 return AudioProcessing::kBadParameterError; |
350 } | 349 } |
351 | 350 |
352 minimum_capture_level_ = minimum; | 351 size_t num_proc_channels_local = 0u; |
353 maximum_capture_level_ = maximum; | 352 int sample_rate_hz_local = 0; |
| 353 { |
| 354 rtc::CritScope cs(crit_capture_); |
354 | 355 |
355 RTC_DCHECK(num_proc_channels_); | 356 minimum_capture_level_ = minimum; |
356 RTC_DCHECK(sample_rate_hz_); | 357 maximum_capture_level_ = maximum; |
357 Initialize(*num_proc_channels_, *sample_rate_hz_); | 358 |
| 359 RTC_DCHECK(num_proc_channels_); |
| 360 RTC_DCHECK(sample_rate_hz_); |
| 361 num_proc_channels_local = *num_proc_channels_; |
| 362 sample_rate_hz_local = *sample_rate_hz_; |
| 363 } |
| 364 Initialize(num_proc_channels_local, sample_rate_hz_local); |
358 return AudioProcessing::kNoError; | 365 return AudioProcessing::kNoError; |
359 } | 366 } |
360 | 367 |
361 int GainControlImpl::analog_level_minimum() const { | 368 int GainControlImpl::analog_level_minimum() const { |
362 rtc::CritScope cs(crit_capture_); | 369 rtc::CritScope cs(crit_capture_); |
363 return minimum_capture_level_; | 370 return minimum_capture_level_; |
364 } | 371 } |
365 | 372 |
366 int GainControlImpl::analog_level_maximum() const { | 373 int GainControlImpl::analog_level_maximum() const { |
367 rtc::CritScope cs(crit_capture_); | 374 rtc::CritScope cs(crit_capture_); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 for (auto& gain_controller : gain_controllers_) { | 492 for (auto& gain_controller : gain_controllers_) { |
486 const int handle_error = | 493 const int handle_error = |
487 WebRtcAgc_set_config(gain_controller->state(), config); | 494 WebRtcAgc_set_config(gain_controller->state(), config); |
488 if (handle_error != AudioProcessing::kNoError) { | 495 if (handle_error != AudioProcessing::kNoError) { |
489 error = handle_error; | 496 error = handle_error; |
490 } | 497 } |
491 } | 498 } |
492 return error; | 499 return error; |
493 } | 500 } |
494 } // namespace webrtc | 501 } // namespace webrtc |
OLD | NEW |