Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: webrtc/modules/audio_processing/echo_cancellation_impl.cc

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 assert(audio->num_frames_per_band() <= 160); 94 assert(audio->num_frames_per_band() <= 160);
95 assert(audio->num_channels() == apm_->num_reverse_channels()); 95 assert(audio->num_channels() == apm_->num_reverse_channels());
96 96
97 int err = AudioProcessing::kNoError; 97 int err = AudioProcessing::kNoError;
98 98
99 // The ordering convention must be followed to pass to the correct AEC. 99 // The ordering convention must be followed to pass to the correct AEC.
100 size_t handle_index = 0; 100 size_t handle_index = 0;
101 render_queue_buffer_.clear(); 101 render_queue_buffer_.clear();
102 for (int i = 0; i < apm_->num_output_channels(); i++) { 102 for (size_t i = 0; i < apm_->num_output_channels(); i++) {
103 for (int j = 0; j < audio->num_channels(); j++) { 103 for (size_t j = 0; j < audio->num_channels(); j++) {
104 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); 104 Handle* my_handle = static_cast<Handle*>(handle(handle_index));
105 // Retrieve any error code produced by the buffering of the farend 105 // Retrieve any error code produced by the buffering of the farend
106 // signal 106 // signal
107 err = WebRtcAec_GetBufferFarendError( 107 err = WebRtcAec_GetBufferFarendError(
108 my_handle, audio->split_bands_const_f(j)[kBand0To8kHz], 108 my_handle, audio->split_bands_const_f(j)[kBand0To8kHz],
109 audio->num_frames_per_band()); 109 audio->num_frames_per_band());
110 110
111 if (err != AudioProcessing::kNoError) { 111 if (err != AudioProcessing::kNoError) {
112 return MapError(err); // TODO(ajm): warning possible? 112 return MapError(err); // TODO(ajm): warning possible?
113 } 113 }
(...skipping 25 matching lines...) Expand all
139 if (!is_component_enabled()) { 139 if (!is_component_enabled()) {
140 return; 140 return;
141 } 141 }
142 142
143 while (render_signal_queue_->Remove(&capture_queue_buffer_)) { 143 while (render_signal_queue_->Remove(&capture_queue_buffer_)) {
144 size_t handle_index = 0; 144 size_t handle_index = 0;
145 size_t buffer_index = 0; 145 size_t buffer_index = 0;
146 const size_t num_frames_per_band = 146 const size_t num_frames_per_band =
147 capture_queue_buffer_.size() / 147 capture_queue_buffer_.size() /
148 (apm_->num_output_channels() * apm_->num_reverse_channels()); 148 (apm_->num_output_channels() * apm_->num_reverse_channels());
149 for (int i = 0; i < apm_->num_output_channels(); i++) { 149 for (size_t i = 0; i < apm_->num_output_channels(); i++) {
150 for (int j = 0; j < apm_->num_reverse_channels(); j++) { 150 for (size_t j = 0; j < apm_->num_reverse_channels(); j++) {
151 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); 151 Handle* my_handle = static_cast<Handle*>(handle(handle_index));
152 WebRtcAec_BufferFarend(my_handle, &capture_queue_buffer_[buffer_index], 152 WebRtcAec_BufferFarend(my_handle, &capture_queue_buffer_[buffer_index],
153 num_frames_per_band); 153 num_frames_per_band);
154 154
155 buffer_index += num_frames_per_band; 155 buffer_index += num_frames_per_band;
156 handle_index++; 156 handle_index++;
157 } 157 }
158 } 158 }
159 } 159 }
160 } 160 }
(...skipping 13 matching lines...) Expand all
174 } 174 }
175 175
176 assert(audio->num_frames_per_band() <= 160); 176 assert(audio->num_frames_per_band() <= 160);
177 assert(audio->num_channels() == apm_->num_proc_channels()); 177 assert(audio->num_channels() == apm_->num_proc_channels());
178 178
179 int err = AudioProcessing::kNoError; 179 int err = AudioProcessing::kNoError;
180 180
181 // The ordering convention must be followed to pass to the correct AEC. 181 // The ordering convention must be followed to pass to the correct AEC.
182 size_t handle_index = 0; 182 size_t handle_index = 0;
183 stream_has_echo_ = false; 183 stream_has_echo_ = false;
184 for (int i = 0; i < audio->num_channels(); i++) { 184 for (size_t i = 0; i < audio->num_channels(); i++) {
185 for (int j = 0; j < apm_->num_reverse_channels(); j++) { 185 for (size_t j = 0; j < apm_->num_reverse_channels(); j++) {
186 Handle* my_handle = handle(handle_index); 186 Handle* my_handle = handle(handle_index);
187 err = WebRtcAec_Process(my_handle, audio->split_bands_const_f(i), 187 err = WebRtcAec_Process(my_handle, audio->split_bands_const_f(i),
188 audio->num_bands(), audio->split_bands_f(i), 188 audio->num_bands(), audio->split_bands_f(i),
189 audio->num_frames_per_band(), 189 audio->num_frames_per_band(),
190 apm_->stream_delay_ms(), stream_drift_samples_); 190 apm_->stream_delay_ms(), stream_drift_samples_);
191 191
192 if (err != AudioProcessing::kNoError) { 192 if (err != AudioProcessing::kNoError) {
193 err = MapError(err); 193 err = MapError(err);
194 // TODO(ajm): Figure out how to return warnings properly. 194 // TODO(ajm): Figure out how to return warnings properly.
195 if (err != AudioProcessing::kBadStreamParameterWarning) { 195 if (err != AudioProcessing::kBadStreamParameterWarning) {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 config.delay_logging = delay_logging_enabled_; 482 config.delay_logging = delay_logging_enabled_;
483 WebRtcAec_enable_extended_filter( 483 WebRtcAec_enable_extended_filter(
484 WebRtcAec_aec_core(static_cast<Handle*>(handle)), 484 WebRtcAec_aec_core(static_cast<Handle*>(handle)),
485 extended_filter_enabled_ ? 1 : 0); 485 extended_filter_enabled_ ? 1 : 0);
486 WebRtcAec_enable_delay_agnostic( 486 WebRtcAec_enable_delay_agnostic(
487 WebRtcAec_aec_core(static_cast<Handle*>(handle)), 487 WebRtcAec_aec_core(static_cast<Handle*>(handle)),
488 delay_agnostic_enabled_ ? 1 : 0); 488 delay_agnostic_enabled_ ? 1 : 0);
489 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); 489 return WebRtcAec_set_config(static_cast<Handle*>(handle), config);
490 } 490 }
491 491
492 int EchoCancellationImpl::num_handles_required() const { 492 size_t EchoCancellationImpl::num_handles_required() const {
493 // Not locked as it only relies on APM public API which is threadsafe. 493 // Not locked as it only relies on APM public API which is threadsafe.
494 return apm_->num_output_channels() * apm_->num_reverse_channels(); 494 return apm_->num_output_channels() * apm_->num_reverse_channels();
495 } 495 }
496 496
497 int EchoCancellationImpl::GetHandleError(void* handle) const { 497 int EchoCancellationImpl::GetHandleError(void* handle) const {
498 // Not locked as it does not rely on anything in the state. 498 // Not locked as it does not rely on anything in the state.
499 assert(handle != NULL); 499 assert(handle != NULL);
500 return AudioProcessing::kUnspecifiedError; 500 return AudioProcessing::kUnspecifiedError;
501 } 501 }
502 } // namespace webrtc 502 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/echo_cancellation_impl.h ('k') | webrtc/modules/audio_processing/echo_control_mobile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698