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 |
11 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" | 11 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include "webrtc/base/constructormagic.h" | 15 #include "webrtc/base/constructormagic.h" |
16 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" | 16 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" |
17 #include "webrtc/modules/audio_processing/audio_buffer.h" | 17 #include "webrtc/modules/audio_processing/audio_buffer.h" |
18 #include "webrtc/system_wrappers/include/logging.h" | |
19 | 18 |
20 namespace webrtc { | 19 namespace webrtc { |
21 | 20 |
22 namespace { | 21 namespace { |
23 int16_t MapSetting(EchoControlMobile::RoutingMode mode) { | 22 int16_t MapSetting(EchoControlMobile::RoutingMode mode) { |
24 switch (mode) { | 23 switch (mode) { |
25 case EchoControlMobile::kQuietEarpieceOrHeadset: | 24 case EchoControlMobile::kQuietEarpieceOrHeadset: |
26 return 0; | 25 return 0; |
27 case EchoControlMobile::kEarpiece: | 26 case EchoControlMobile::kEarpiece: |
28 return 1; | 27 return 1; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 rtc::CritScope cs_capture(crit_capture_); | 346 rtc::CritScope cs_capture(crit_capture_); |
348 | 347 |
349 stream_properties_.reset(new StreamProperties( | 348 stream_properties_.reset(new StreamProperties( |
350 sample_rate_hz, num_reverse_channels, num_output_channels)); | 349 sample_rate_hz, num_reverse_channels, num_output_channels)); |
351 | 350 |
352 if (!enabled_) { | 351 if (!enabled_) { |
353 return; | 352 return; |
354 } | 353 } |
355 | 354 |
356 if (stream_properties_->sample_rate_hz > AudioProcessing::kSampleRate16kHz) { | 355 if (stream_properties_->sample_rate_hz > AudioProcessing::kSampleRate16kHz) { |
357 LOG(LS_ERROR) << "AECM only supports 16 kHz or lower sample rates"; | |
358 } | 356 } |
359 | 357 |
360 cancellers_.resize( | 358 cancellers_.resize( |
361 NumCancellersRequired(stream_properties_->num_output_channels, | 359 NumCancellersRequired(stream_properties_->num_output_channels, |
362 stream_properties_->num_reverse_channels)); | 360 stream_properties_->num_reverse_channels)); |
363 | 361 |
364 for (auto& canceller : cancellers_) { | 362 for (auto& canceller : cancellers_) { |
365 if (!canceller) { | 363 if (!canceller) { |
366 canceller.reset(new Canceller()); | 364 canceller.reset(new Canceller()); |
367 } | 365 } |
(...skipping 14 matching lines...) Expand all Loading... |
382 for (auto& canceller : cancellers_) { | 380 for (auto& canceller : cancellers_) { |
383 int handle_error = WebRtcAecm_set_config(canceller->state(), config); | 381 int handle_error = WebRtcAecm_set_config(canceller->state(), config); |
384 if (handle_error != AudioProcessing::kNoError) { | 382 if (handle_error != AudioProcessing::kNoError) { |
385 error = handle_error; | 383 error = handle_error; |
386 } | 384 } |
387 } | 385 } |
388 return error; | 386 return error; |
389 } | 387 } |
390 | 388 |
391 } // namespace webrtc | 389 } // namespace webrtc |
OLD | NEW |