| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 490 } |
| 491 | 491 |
| 492 // Returns true if the device both supports built in AEC and the device | 492 // Returns true if the device both supports built in AEC and the device |
| 493 // is not blacklisted. | 493 // is not blacklisted. |
| 494 bool BuiltInAECIsAvailable() const override { | 494 bool BuiltInAECIsAvailable() const override { |
| 495 LOG(INFO) << __FUNCTION__; | 495 LOG(INFO) << __FUNCTION__; |
| 496 return audio_manager_->IsAcousticEchoCancelerSupported(); | 496 return audio_manager_->IsAcousticEchoCancelerSupported(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 int32_t EnableBuiltInAEC(bool enable) override { | 499 int32_t EnableBuiltInAEC(bool enable) override { |
| 500 if (enable) { | 500 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 501 LOG(INFO) << __FUNCTION__ << ": enabling built in AEC"; | |
| 502 } else { | |
| 503 LOG(INFO) << __FUNCTION__ << ": disabling built in AEC"; | |
| 504 } | |
| 505 RTC_CHECK(BuiltInAECIsAvailable()) << "HW AEC is not available"; | 501 RTC_CHECK(BuiltInAECIsAvailable()) << "HW AEC is not available"; |
| 506 return input_.EnableBuiltInAEC(enable); | 502 return input_.EnableBuiltInAEC(enable); |
| 507 } | 503 } |
| 508 | 504 |
| 509 // Returns true if the device both supports built in AGC and the device | 505 // Returns true if the device both supports built in AGC and the device |
| 510 // is not blacklisted. | 506 // is not blacklisted. |
| 511 bool BuiltInAGCIsAvailable() const override { | 507 bool BuiltInAGCIsAvailable() const override { |
| 512 LOG(INFO) << __FUNCTION__; | 508 LOG(INFO) << __FUNCTION__; |
| 513 return audio_manager_->IsAutomaticGainControlSupported(); | 509 return audio_manager_->IsAutomaticGainControlSupported(); |
| 514 } | 510 } |
| 515 | 511 |
| 516 int32_t EnableBuiltInAGC(bool enable) override { | 512 int32_t EnableBuiltInAGC(bool enable) override { |
| 517 if (enable) { | 513 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 518 LOG(INFO) << __FUNCTION__ << ": enabling built in AGC"; | |
| 519 } else { | |
| 520 LOG(INFO) << __FUNCTION__ << ": disabling built in AGC"; | |
| 521 } | |
| 522 RTC_CHECK(BuiltInAGCIsAvailable()) << "HW AGC is not available"; | 514 RTC_CHECK(BuiltInAGCIsAvailable()) << "HW AGC is not available"; |
| 523 return input_.EnableBuiltInAGC(enable); | 515 return input_.EnableBuiltInAGC(enable); |
| 524 } | 516 } |
| 525 | 517 |
| 526 // Returns true if the device both supports built in NS and the device | 518 // Returns true if the device both supports built in NS and the device |
| 527 // is not blacklisted. | 519 // is not blacklisted. |
| 528 bool BuiltInNSIsAvailable() const override { | 520 bool BuiltInNSIsAvailable() const override { |
| 529 LOG(INFO) << __FUNCTION__; | 521 LOG(INFO) << __FUNCTION__; |
| 530 return audio_manager_->IsNoiseSuppressorSupported(); | 522 return audio_manager_->IsNoiseSuppressorSupported(); |
| 531 } | 523 } |
| 532 | 524 |
| 533 int32_t EnableBuiltInNS(bool enable) override { | 525 int32_t EnableBuiltInNS(bool enable) override { |
| 534 if (enable) { | 526 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 535 LOG(INFO) << __FUNCTION__ << ": enabling built in NS"; | |
| 536 } else { | |
| 537 LOG(INFO) << __FUNCTION__ << ": disabling built in NS"; | |
| 538 } | |
| 539 RTC_CHECK(BuiltInNSIsAvailable()) << "HW NS is not available"; | 527 RTC_CHECK(BuiltInNSIsAvailable()) << "HW NS is not available"; |
| 540 return input_.EnableBuiltInNS(enable); | 528 return input_.EnableBuiltInNS(enable); |
| 541 } | 529 } |
| 542 | 530 |
| 543 private: | 531 private: |
| 544 rtc::ThreadChecker thread_checker_; | 532 rtc::ThreadChecker thread_checker_; |
| 545 | 533 |
| 546 // Local copy of the audio layer set during construction of the | 534 // Local copy of the audio layer set during construction of the |
| 547 // AudioDeviceModuleImpl instance. Read only value. | 535 // AudioDeviceModuleImpl instance. Read only value. |
| 548 const AudioDeviceModule::AudioLayer audio_layer_; | 536 const AudioDeviceModule::AudioLayer audio_layer_; |
| 549 | 537 |
| 550 // Non-owning raw pointer to AudioManager instance given to use at | 538 // Non-owning raw pointer to AudioManager instance given to use at |
| 551 // construction. The real object is owned by AudioDeviceModuleImpl and the | 539 // construction. The real object is owned by AudioDeviceModuleImpl and the |
| 552 // life time is the same as that of the AudioDeviceModuleImpl, hence there | 540 // life time is the same as that of the AudioDeviceModuleImpl, hence there |
| 553 // is no risk of reading a NULL pointer at any time in this class. | 541 // is no risk of reading a NULL pointer at any time in this class. |
| 554 AudioManager* const audio_manager_; | 542 AudioManager* const audio_manager_; |
| 555 | 543 |
| 556 OutputType output_; | 544 OutputType output_; |
| 557 | 545 |
| 558 InputType input_; | 546 InputType input_; |
| 559 | 547 |
| 560 bool initialized_; | 548 bool initialized_; |
| 561 }; | 549 }; |
| 562 | 550 |
| 563 } // namespace webrtc | 551 } // namespace webrtc |
| 564 | 552 |
| 565 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ | 553 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ |
| OLD | NEW |