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

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

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 int err = apm_->kNoError; 84 int err = apm_->kNoError;
85 85
86 // The ordering convention must be followed to pass to the correct AEC. 86 // The ordering convention must be followed to pass to the correct AEC.
87 size_t handle_index = 0; 87 size_t handle_index = 0;
88 for (int i = 0; i < apm_->num_output_channels(); i++) { 88 for (int i = 0; i < apm_->num_output_channels(); i++) {
89 for (int j = 0; j < audio->num_channels(); j++) { 89 for (int j = 0; j < audio->num_channels(); j++) {
90 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); 90 Handle* my_handle = static_cast<Handle*>(handle(handle_index));
91 err = WebRtcAec_BufferFarend( 91 err = WebRtcAec_BufferFarend(
92 my_handle, 92 my_handle,
93 audio->split_bands_const_f(j)[kBand0To8kHz], 93 audio->split_bands_const_f(j)[kBand0To8kHz],
94 static_cast<int16_t>(audio->num_frames_per_band())); 94 audio->num_frames_per_band());
95 95
96 if (err != apm_->kNoError) { 96 if (err != apm_->kNoError) {
97 return GetHandleError(my_handle); // TODO(ajm): warning possible? 97 return GetHandleError(my_handle); // TODO(ajm): warning possible?
98 } 98 }
99 99
100 handle_index++; 100 handle_index++;
101 } 101 }
102 } 102 }
103 103
104 return apm_->kNoError; 104 return apm_->kNoError;
(...skipping 21 matching lines...) Expand all
126 size_t handle_index = 0; 126 size_t handle_index = 0;
127 stream_has_echo_ = false; 127 stream_has_echo_ = false;
128 for (int i = 0; i < audio->num_channels(); i++) { 128 for (int i = 0; i < audio->num_channels(); i++) {
129 for (int j = 0; j < apm_->num_reverse_channels(); j++) { 129 for (int j = 0; j < apm_->num_reverse_channels(); j++) {
130 Handle* my_handle = handle(handle_index); 130 Handle* my_handle = handle(handle_index);
131 err = WebRtcAec_Process( 131 err = WebRtcAec_Process(
132 my_handle, 132 my_handle,
133 audio->split_bands_const_f(i), 133 audio->split_bands_const_f(i),
134 audio->num_bands(), 134 audio->num_bands(),
135 audio->split_bands_f(i), 135 audio->split_bands_f(i),
136 static_cast<int16_t>(audio->num_frames_per_band()), 136 audio->num_frames_per_band(),
137 apm_->stream_delay_ms(), 137 apm_->stream_delay_ms(),
138 stream_drift_samples_); 138 stream_drift_samples_);
139 139
140 if (err != apm_->kNoError) { 140 if (err != apm_->kNoError) {
141 err = GetHandleError(my_handle); 141 err = GetHandleError(my_handle);
142 // TODO(ajm): Figure out how to return warnings properly. 142 // TODO(ajm): Figure out how to return warnings properly.
143 if (err != apm_->kBadStreamParameterWarning) { 143 if (err != apm_->kBadStreamParameterWarning) {
144 return err; 144 return err;
145 } 145 }
146 } 146 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 int EchoCancellationImpl::num_handles_required() const { 372 int EchoCancellationImpl::num_handles_required() const {
373 return apm_->num_output_channels() * 373 return apm_->num_output_channels() *
374 apm_->num_reverse_channels(); 374 apm_->num_reverse_channels();
375 } 375 }
376 376
377 int EchoCancellationImpl::GetHandleError(void* handle) const { 377 int EchoCancellationImpl::GetHandleError(void* handle) const {
378 assert(handle != NULL); 378 assert(handle != NULL);
379 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle))); 379 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle)));
380 } 380 }
381 } // namespace webrtc 381 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698