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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 clean, | 199 clean, |
200 audio->split_bands(i)[kBand0To8kHz], | 200 audio->split_bands(i)[kBand0To8kHz], |
201 audio->num_frames_per_band(), | 201 audio->num_frames_per_band(), |
202 apm_->stream_delay_ms()); | 202 apm_->stream_delay_ms()); |
203 | 203 |
204 if (err != AudioProcessing::kNoError) | 204 if (err != AudioProcessing::kNoError) |
205 return MapError(err); | 205 return MapError(err); |
206 | 206 |
207 handle_index++; | 207 handle_index++; |
208 } | 208 } |
209 for (size_t band = 1u; band < audio->num_bands(); ++band) { | |
210 memset(audio->split_bands(i)[band], | |
211 0, | |
212 audio->num_frames_per_band() * | |
213 sizeof(audio->split_bands(i)[band][0])); | |
214 } | |
215 } | 209 } |
216 | 210 |
217 return AudioProcessing::kNoError; | 211 return AudioProcessing::kNoError; |
218 } | 212 } |
219 | 213 |
220 int EchoControlMobileImpl::Enable(bool enable) { | 214 int EchoControlMobileImpl::Enable(bool enable) { |
221 // Ensure AEC and AECM are not both enabled. | 215 // Ensure AEC and AECM are not both enabled. |
222 rtc::CritScope cs_render(crit_render_); | 216 rtc::CritScope cs_render(crit_render_); |
223 rtc::CritScope cs_capture(crit_capture_); | 217 rtc::CritScope cs_capture(crit_capture_); |
224 // The is_enabled call is safe from a deadlock perspective | 218 // The is_enabled call is safe from a deadlock perspective |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 306 } |
313 | 307 |
314 int EchoControlMobileImpl::Initialize() { | 308 int EchoControlMobileImpl::Initialize() { |
315 { | 309 { |
316 rtc::CritScope cs_capture(crit_capture_); | 310 rtc::CritScope cs_capture(crit_capture_); |
317 if (!is_component_enabled()) { | 311 if (!is_component_enabled()) { |
318 return AudioProcessing::kNoError; | 312 return AudioProcessing::kNoError; |
319 } | 313 } |
320 } | 314 } |
321 | 315 |
322 if (apm_->proc_split_sample_rate_hz() > AudioProcessing::kSampleRate16kHz) { | 316 if (apm_->proc_sample_rate_hz() > AudioProcessing::kSampleRate16kHz) { |
323 LOG(LS_ERROR) << "AECM only supports 16 kHz or lower split sample rates"; | 317 LOG(LS_ERROR) << "AECM only supports 16 kHz or lower sample rates"; |
324 return AudioProcessing::kBadSampleRateError; | 318 return AudioProcessing::kBadSampleRateError; |
325 } | 319 } |
326 | 320 |
327 int err = ProcessingComponent::Initialize(); | 321 int err = ProcessingComponent::Initialize(); |
328 if (err != AudioProcessing::kNoError) { | 322 if (err != AudioProcessing::kNoError) { |
329 return err; | 323 return err; |
330 } | 324 } |
331 | 325 |
332 AllocateRenderQueue(); | 326 AllocateRenderQueue(); |
333 | 327 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // This method is only called in a non-concurrent manner during APM | 363 // This method is only called in a non-concurrent manner during APM |
370 // destruction. | 364 // destruction. |
371 WebRtcAecm_Free(static_cast<Handle*>(handle)); | 365 WebRtcAecm_Free(static_cast<Handle*>(handle)); |
372 } | 366 } |
373 | 367 |
374 int EchoControlMobileImpl::InitializeHandle(void* handle) const { | 368 int EchoControlMobileImpl::InitializeHandle(void* handle) const { |
375 rtc::CritScope cs_render(crit_render_); | 369 rtc::CritScope cs_render(crit_render_); |
376 rtc::CritScope cs_capture(crit_capture_); | 370 rtc::CritScope cs_capture(crit_capture_); |
377 assert(handle != NULL); | 371 assert(handle != NULL); |
378 Handle* my_handle = static_cast<Handle*>(handle); | 372 Handle* my_handle = static_cast<Handle*>(handle); |
379 if (WebRtcAecm_Init(my_handle, apm_->proc_split_sample_rate_hz()) != 0) { | 373 if (WebRtcAecm_Init(my_handle, apm_->proc_sample_rate_hz()) != 0) { |
380 return GetHandleError(my_handle); | 374 return GetHandleError(my_handle); |
381 } | 375 } |
382 if (external_echo_path_ != NULL) { | 376 if (external_echo_path_ != NULL) { |
383 if (WebRtcAecm_InitEchoPath(my_handle, | 377 if (WebRtcAecm_InitEchoPath(my_handle, |
384 external_echo_path_, | 378 external_echo_path_, |
385 echo_path_size_bytes()) != 0) { | 379 echo_path_size_bytes()) != 0) { |
386 return GetHandleError(my_handle); | 380 return GetHandleError(my_handle); |
387 } | 381 } |
388 } | 382 } |
389 | 383 |
(...skipping 14 matching lines...) Expand all Loading... |
404 // Not locked as it only relies on APM public API which is threadsafe. | 398 // Not locked as it only relies on APM public API which is threadsafe. |
405 return apm_->num_output_channels() * apm_->num_reverse_channels(); | 399 return apm_->num_output_channels() * apm_->num_reverse_channels(); |
406 } | 400 } |
407 | 401 |
408 int EchoControlMobileImpl::GetHandleError(void* handle) const { | 402 int EchoControlMobileImpl::GetHandleError(void* handle) const { |
409 // Not locked as it does not rely on anything in the state. | 403 // Not locked as it does not rely on anything in the state. |
410 assert(handle != NULL); | 404 assert(handle != NULL); |
411 return AudioProcessing::kUnspecifiedError; | 405 return AudioProcessing::kUnspecifiedError; |
412 } | 406 } |
413 } // namespace webrtc | 407 } // namespace webrtc |
OLD | NEW |