| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return apm_->kNoError; | 83 return apm_->kNoError; |
| 84 } | 84 } |
| 85 | 85 |
| 86 assert(audio->num_frames_per_band() <= 160); | 86 assert(audio->num_frames_per_band() <= 160); |
| 87 assert(audio->num_channels() == apm_->num_reverse_channels()); | 87 assert(audio->num_channels() == apm_->num_reverse_channels()); |
| 88 | 88 |
| 89 int err = apm_->kNoError; | 89 int err = apm_->kNoError; |
| 90 | 90 |
| 91 // The ordering convention must be followed to pass to the correct AECM. | 91 // The ordering convention must be followed to pass to the correct AECM. |
| 92 size_t handle_index = 0; | 92 size_t handle_index = 0; |
| 93 for (int i = 0; i < apm_->num_output_channels(); i++) { | 93 for (size_t i = 0; i < apm_->num_output_channels(); i++) { |
| 94 for (int j = 0; j < audio->num_channels(); j++) { | 94 for (size_t j = 0; j < audio->num_channels(); j++) { |
| 95 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); | 95 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); |
| 96 err = WebRtcAecm_BufferFarend( | 96 err = WebRtcAecm_BufferFarend( |
| 97 my_handle, | 97 my_handle, |
| 98 audio->split_bands_const(j)[kBand0To8kHz], | 98 audio->split_bands_const(j)[kBand0To8kHz], |
| 99 audio->num_frames_per_band()); | 99 audio->num_frames_per_band()); |
| 100 | 100 |
| 101 if (err != apm_->kNoError) { | 101 if (err != apm_->kNoError) { |
| 102 return GetHandleError(my_handle); // TODO(ajm): warning possible? | 102 return GetHandleError(my_handle); // TODO(ajm): warning possible? |
| 103 } | 103 } |
| 104 | 104 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 118 return apm_->kStreamParameterNotSetError; | 118 return apm_->kStreamParameterNotSetError; |
| 119 } | 119 } |
| 120 | 120 |
| 121 assert(audio->num_frames_per_band() <= 160); | 121 assert(audio->num_frames_per_band() <= 160); |
| 122 assert(audio->num_channels() == apm_->num_output_channels()); | 122 assert(audio->num_channels() == apm_->num_output_channels()); |
| 123 | 123 |
| 124 int err = apm_->kNoError; | 124 int err = apm_->kNoError; |
| 125 | 125 |
| 126 // The ordering convention must be followed to pass to the correct AECM. | 126 // The ordering convention must be followed to pass to the correct AECM. |
| 127 size_t handle_index = 0; | 127 size_t handle_index = 0; |
| 128 for (int i = 0; i < audio->num_channels(); i++) { | 128 for (size_t i = 0; i < audio->num_channels(); i++) { |
| 129 // TODO(ajm): improve how this works, possibly inside AECM. | 129 // TODO(ajm): improve how this works, possibly inside AECM. |
| 130 // This is kind of hacked up. | 130 // This is kind of hacked up. |
| 131 const int16_t* noisy = audio->low_pass_reference(i); | 131 const int16_t* noisy = audio->low_pass_reference(i); |
| 132 const int16_t* clean = audio->split_bands_const(i)[kBand0To8kHz]; | 132 const int16_t* clean = audio->split_bands_const(i)[kBand0To8kHz]; |
| 133 if (noisy == NULL) { | 133 if (noisy == NULL) { |
| 134 noisy = clean; | 134 noisy = clean; |
| 135 clean = NULL; | 135 clean = NULL; |
| 136 } | 136 } |
| 137 for (int j = 0; j < apm_->num_reverse_channels(); j++) { | 137 for (size_t j = 0; j < apm_->num_reverse_channels(); j++) { |
| 138 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); | 138 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); |
| 139 err = WebRtcAecm_Process( | 139 err = WebRtcAecm_Process( |
| 140 my_handle, | 140 my_handle, |
| 141 noisy, | 141 noisy, |
| 142 clean, | 142 clean, |
| 143 audio->split_bands(i)[kBand0To8kHz], | 143 audio->split_bands(i)[kBand0To8kHz], |
| 144 audio->num_frames_per_band(), | 144 audio->num_frames_per_band(), |
| 145 apm_->stream_delay_ms()); | 145 apm_->stream_delay_ms()); |
| 146 | 146 |
| 147 if (err != apm_->kNoError) { | 147 if (err != apm_->kNoError) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 | 276 |
| 277 int EchoControlMobileImpl::ConfigureHandle(void* handle) const { | 277 int EchoControlMobileImpl::ConfigureHandle(void* handle) const { |
| 278 AecmConfig config; | 278 AecmConfig config; |
| 279 config.cngMode = comfort_noise_enabled_; | 279 config.cngMode = comfort_noise_enabled_; |
| 280 config.echoMode = MapSetting(routing_mode_); | 280 config.echoMode = MapSetting(routing_mode_); |
| 281 | 281 |
| 282 return WebRtcAecm_set_config(static_cast<Handle*>(handle), config); | 282 return WebRtcAecm_set_config(static_cast<Handle*>(handle), config); |
| 283 } | 283 } |
| 284 | 284 |
| 285 int EchoControlMobileImpl::num_handles_required() const { | 285 size_t EchoControlMobileImpl::num_handles_required() const { |
| 286 return apm_->num_output_channels() * | 286 return apm_->num_output_channels() * |
| 287 apm_->num_reverse_channels(); | 287 apm_->num_reverse_channels(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 int EchoControlMobileImpl::GetHandleError(void* handle) const { | 290 int EchoControlMobileImpl::GetHandleError(void* handle) const { |
| 291 assert(handle != NULL); | 291 assert(handle != NULL); |
| 292 return MapError(WebRtcAecm_get_error_code(static_cast<Handle*>(handle))); | 292 return MapError(WebRtcAecm_get_error_code(static_cast<Handle*>(handle))); |
| 293 } | 293 } |
| 294 } // namespace webrtc | 294 } // namespace webrtc |
| OLD | NEW |