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 bool GainControlImpl::is_limiter_enabled() const { | 289 bool GainControlImpl::is_limiter_enabled() const { |
290 return limiter_enabled_; | 290 return limiter_enabled_; |
291 } | 291 } |
292 | 292 |
293 int GainControlImpl::Initialize() { | 293 int GainControlImpl::Initialize() { |
294 int err = ProcessingComponent::Initialize(); | 294 int err = ProcessingComponent::Initialize(); |
295 if (err != apm_->kNoError || !is_component_enabled()) { | 295 if (err != apm_->kNoError || !is_component_enabled()) { |
296 return err; | 296 return err; |
297 } | 297 } |
298 | 298 |
299 capture_levels_.assign(num_handles(), analog_capture_level_); | 299 const int n = num_handles(); |
| 300 RTC_CHECK_GE(n, 0) << "Bad number of handles: " << n; |
| 301 capture_levels_.assign(n, analog_capture_level_); |
300 return apm_->kNoError; | 302 return apm_->kNoError; |
301 } | 303 } |
302 | 304 |
303 void* GainControlImpl::CreateHandle() const { | 305 void* GainControlImpl::CreateHandle() const { |
304 return WebRtcAgc_Create(); | 306 return WebRtcAgc_Create(); |
305 } | 307 } |
306 | 308 |
307 void GainControlImpl::DestroyHandle(void* handle) const { | 309 void GainControlImpl::DestroyHandle(void* handle) const { |
308 WebRtcAgc_Free(static_cast<Handle*>(handle)); | 310 WebRtcAgc_Free(static_cast<Handle*>(handle)); |
309 } | 311 } |
(...skipping 24 matching lines...) Expand all Loading... |
334 return apm_->num_output_channels(); | 336 return apm_->num_output_channels(); |
335 } | 337 } |
336 | 338 |
337 int GainControlImpl::GetHandleError(void* handle) const { | 339 int GainControlImpl::GetHandleError(void* handle) const { |
338 // The AGC has no get_error() function. | 340 // The AGC has no get_error() function. |
339 // (Despite listing errors in its interface...) | 341 // (Despite listing errors in its interface...) |
340 assert(handle != NULL); | 342 assert(handle != NULL); |
341 return apm_->kUnspecifiedError; | 343 return apm_->kUnspecifiedError; |
342 } | 344 } |
343 } // namespace webrtc | 345 } // namespace webrtc |
OLD | NEW |