| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 enabled_ = enable; | 48 enabled_ = enable; |
| 49 } | 49 } |
| 50 | 50 |
| 51 return AudioProcessing::kNoError; | 51 return AudioProcessing::kNoError; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool ProcessingComponent::is_component_enabled() const { | 54 bool ProcessingComponent::is_component_enabled() const { |
| 55 return enabled_; | 55 return enabled_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void* ProcessingComponent::handle(int index) const { | 58 void* ProcessingComponent::handle(size_t index) const { |
| 59 assert(index < num_handles_); | 59 assert(index < num_handles_); |
| 60 return handles_[index]; | 60 return handles_[index]; |
| 61 } | 61 } |
| 62 | 62 |
| 63 int ProcessingComponent::num_handles() const { | 63 size_t ProcessingComponent::num_handles() const { |
| 64 return num_handles_; | 64 return num_handles_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 int ProcessingComponent::Initialize() { | 67 int ProcessingComponent::Initialize() { |
| 68 if (!enabled_) { | 68 if (!enabled_) { |
| 69 return AudioProcessing::kNoError; | 69 return AudioProcessing::kNoError; |
| 70 } | 70 } |
| 71 | 71 |
| 72 num_handles_ = num_handles_required(); | 72 num_handles_ = num_handles_required(); |
| 73 if (num_handles_ > static_cast<int>(handles_.size())) { | 73 if (num_handles_ > handles_.size()) { |
| 74 handles_.resize(num_handles_, NULL); | 74 handles_.resize(num_handles_, NULL); |
| 75 } | 75 } |
| 76 | 76 |
| 77 assert(static_cast<int>(handles_.size()) >= num_handles_); | 77 assert(handles_.size() >= num_handles_); |
| 78 for (int i = 0; i < num_handles_; i++) { | 78 for (size_t i = 0; i < num_handles_; i++) { |
| 79 if (handles_[i] == NULL) { | 79 if (handles_[i] == NULL) { |
| 80 handles_[i] = CreateHandle(); | 80 handles_[i] = CreateHandle(); |
| 81 if (handles_[i] == NULL) { | 81 if (handles_[i] == NULL) { |
| 82 return AudioProcessing::kCreationFailedError; | 82 return AudioProcessing::kCreationFailedError; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 int err = InitializeHandle(handles_[i]); | 86 int err = InitializeHandle(handles_[i]); |
| 87 if (err != AudioProcessing::kNoError) { | 87 if (err != AudioProcessing::kNoError) { |
| 88 return GetHandleError(handles_[i]); | 88 return GetHandleError(handles_[i]); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 initialized_ = true; | 92 initialized_ = true; |
| 93 return Configure(); | 93 return Configure(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 int ProcessingComponent::Configure() { | 96 int ProcessingComponent::Configure() { |
| 97 if (!initialized_) { | 97 if (!initialized_) { |
| 98 return AudioProcessing::kNoError; | 98 return AudioProcessing::kNoError; |
| 99 } | 99 } |
| 100 | 100 |
| 101 assert(static_cast<int>(handles_.size()) >= num_handles_); | 101 assert(handles_.size() >= num_handles_); |
| 102 for (int i = 0; i < num_handles_; i++) { | 102 for (size_t i = 0; i < num_handles_; i++) { |
| 103 int err = ConfigureHandle(handles_[i]); | 103 int err = ConfigureHandle(handles_[i]); |
| 104 if (err != AudioProcessing::kNoError) { | 104 if (err != AudioProcessing::kNoError) { |
| 105 return GetHandleError(handles_[i]); | 105 return GetHandleError(handles_[i]); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 return AudioProcessing::kNoError; | 109 return AudioProcessing::kNoError; |
| 110 } | 110 } |
| 111 } // namespace webrtc | 111 } // namespace webrtc |
| OLD | NEW |