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 } | |
209 } | 215 } |
210 | 216 |
211 return AudioProcessing::kNoError; | 217 return AudioProcessing::kNoError; |
212 } | 218 } |
213 | 219 |
214 int EchoControlMobileImpl::Enable(bool enable) { | 220 int EchoControlMobileImpl::Enable(bool enable) { |
215 // Ensure AEC and AECM are not both enabled. | 221 // Ensure AEC and AECM are not both enabled. |
216 rtc::CritScope cs_render(crit_render_); | 222 rtc::CritScope cs_render(crit_render_); |
217 rtc::CritScope cs_capture(crit_capture_); | 223 rtc::CritScope cs_capture(crit_capture_); |
218 // The is_enabled call is safe from a deadlock perspective | 224 // The is_enabled call is safe from a deadlock perspective |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 return AudioProcessing::kNoError; | 311 return AudioProcessing::kNoError; |
306 } | 312 } |
307 | 313 |
308 int EchoControlMobileImpl::Initialize() { | 314 int EchoControlMobileImpl::Initialize() { |
309 { | 315 { |
310 rtc::CritScope cs_capture(crit_capture_); | 316 rtc::CritScope cs_capture(crit_capture_); |
311 if (!is_component_enabled()) { | 317 if (!is_component_enabled()) { |
312 return AudioProcessing::kNoError; | 318 return AudioProcessing::kNoError; |
313 } | 319 } |
314 } | 320 } |
315 | 321 |
peah-webrtc
2016/03/11 11:34:39
Regarding proc_split_sample_rate_hz(), can that ev
aluebs-webrtc
2016/03/11 13:27:05
As it is today, it is always 16kHz except when the
peah-webrtc
2016/03/11 21:37:28
We really need to change the names of these functi
aluebs-webrtc
2016/03/14 17:30:40
I agree it probably can have a better name, but th
| |
316 if (apm_->proc_sample_rate_hz() > AudioProcessing::kSampleRate16kHz) { | 322 if (apm_->proc_split_sample_rate_hz() > AudioProcessing::kSampleRate16kHz) { |
317 LOG(LS_ERROR) << "AECM only supports 16 kHz or lower sample rates"; | 323 LOG(LS_ERROR) << "AECM only supports 16 kHz or lower split sample rates"; |
318 return AudioProcessing::kBadSampleRateError; | 324 return AudioProcessing::kBadSampleRateError; |
319 } | 325 } |
320 | 326 |
321 int err = ProcessingComponent::Initialize(); | 327 int err = ProcessingComponent::Initialize(); |
322 if (err != AudioProcessing::kNoError) { | 328 if (err != AudioProcessing::kNoError) { |
323 return err; | 329 return err; |
324 } | 330 } |
325 | 331 |
326 AllocateRenderQueue(); | 332 AllocateRenderQueue(); |
327 | 333 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 // This method is only called in a non-concurrent manner during APM | 369 // This method is only called in a non-concurrent manner during APM |
364 // destruction. | 370 // destruction. |
365 WebRtcAecm_Free(static_cast<Handle*>(handle)); | 371 WebRtcAecm_Free(static_cast<Handle*>(handle)); |
366 } | 372 } |
367 | 373 |
368 int EchoControlMobileImpl::InitializeHandle(void* handle) const { | 374 int EchoControlMobileImpl::InitializeHandle(void* handle) const { |
369 rtc::CritScope cs_render(crit_render_); | 375 rtc::CritScope cs_render(crit_render_); |
370 rtc::CritScope cs_capture(crit_capture_); | 376 rtc::CritScope cs_capture(crit_capture_); |
371 assert(handle != NULL); | 377 assert(handle != NULL); |
372 Handle* my_handle = static_cast<Handle*>(handle); | 378 Handle* my_handle = static_cast<Handle*>(handle); |
373 if (WebRtcAecm_Init(my_handle, apm_->proc_sample_rate_hz()) != 0) { | 379 if (WebRtcAecm_Init(my_handle, apm_->proc_split_sample_rate_hz()) != 0) { |
374 return GetHandleError(my_handle); | 380 return GetHandleError(my_handle); |
375 } | 381 } |
376 if (external_echo_path_ != NULL) { | 382 if (external_echo_path_ != NULL) { |
377 if (WebRtcAecm_InitEchoPath(my_handle, | 383 if (WebRtcAecm_InitEchoPath(my_handle, |
378 external_echo_path_, | 384 external_echo_path_, |
379 echo_path_size_bytes()) != 0) { | 385 echo_path_size_bytes()) != 0) { |
380 return GetHandleError(my_handle); | 386 return GetHandleError(my_handle); |
381 } | 387 } |
382 } | 388 } |
383 | 389 |
(...skipping 14 matching lines...) Expand all Loading... | |
398 // Not locked as it only relies on APM public API which is threadsafe. | 404 // Not locked as it only relies on APM public API which is threadsafe. |
399 return apm_->num_output_channels() * apm_->num_reverse_channels(); | 405 return apm_->num_output_channels() * apm_->num_reverse_channels(); |
400 } | 406 } |
401 | 407 |
402 int EchoControlMobileImpl::GetHandleError(void* handle) const { | 408 int EchoControlMobileImpl::GetHandleError(void* handle) const { |
403 // Not locked as it does not rely on anything in the state. | 409 // Not locked as it does not rely on anything in the state. |
404 assert(handle != NULL); | 410 assert(handle != NULL); |
405 return AudioProcessing::kUnspecifiedError; | 411 return AudioProcessing::kUnspecifiedError; |
406 } | 412 } |
407 } // namespace webrtc | 413 } // namespace webrtc |
OLD | NEW |