Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: webrtc/modules/audio_device/android/audio_device_template.h

Issue 2119633004: Adds support for OpenSL ES based audio capture on Android (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing presubmit warnings Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 return -1; 478 return -1;
479 } 479 }
480 480
481 int32_t GetLoudspeakerStatus(bool& enable) const override { 481 int32_t GetLoudspeakerStatus(bool& enable) const override {
482 FATAL() << "Should never be called"; 482 FATAL() << "Should never be called";
483 return -1; 483 return -1;
484 } 484 }
485 485
486 // Returns true if the device both supports built in AEC and the device 486 // Returns true if the device both supports built in AEC and the device
487 // is not blacklisted. 487 // is not blacklisted.
488 // Currently, if OpenSL ES is used in both directions, this method will still
489 // report the correct value and it has the correct effect. As an example:
490 // a device supports built in AEC and this method returns true. Libjingle
491 // will then disable the WebRTC based AEC and that will work for all devices
492 // (mainly Nexus) even when OpenSL ES is used for input since our current
493 // implementation will enable built-in AEC by default also for OpenSL ES.
494 // The only "bad" thing that happens today is that when Libjingle calls
495 // OpenSLESRecorder::EnableBuiltInAEC() it will not have any real effect and
496 // a "Not Implemented" log will be filed. This non-perfect state will remain
497 // until I have added full support for audio effects based on OpenSL ES APIs.
488 bool BuiltInAECIsAvailable() const override { 498 bool BuiltInAECIsAvailable() const override {
489 LOG(INFO) << __FUNCTION__; 499 LOG(INFO) << __FUNCTION__;
490 return audio_manager_->IsAcousticEchoCancelerSupported(); 500 return audio_manager_->IsAcousticEchoCancelerSupported();
491 } 501 }
492 502
503 // TODO(henrika): add implementation for OpenSL ES based audio as well.
493 int32_t EnableBuiltInAEC(bool enable) override { 504 int32_t EnableBuiltInAEC(bool enable) override {
494 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; 505 LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
495 RTC_CHECK(BuiltInAECIsAvailable()) << "HW AEC is not available"; 506 RTC_CHECK(BuiltInAECIsAvailable()) << "HW AEC is not available";
496 return input_.EnableBuiltInAEC(enable); 507 return input_.EnableBuiltInAEC(enable);
497 } 508 }
498 509
499 // Returns true if the device both supports built in AGC and the device 510 // Returns true if the device both supports built in AGC and the device
500 // is not blacklisted. 511 // is not blacklisted.
512 // TODO(henrika): add implementation for OpenSL ES based audio as well.
513 // In addition, see comments for BuiltInAECIsAvailable().
501 bool BuiltInAGCIsAvailable() const override { 514 bool BuiltInAGCIsAvailable() const override {
502 LOG(INFO) << __FUNCTION__; 515 LOG(INFO) << __FUNCTION__;
503 return audio_manager_->IsAutomaticGainControlSupported(); 516 return audio_manager_->IsAutomaticGainControlSupported();
504 } 517 }
505 518
519 // TODO(henrika): add implementation for OpenSL ES based audio as well.
506 int32_t EnableBuiltInAGC(bool enable) override { 520 int32_t EnableBuiltInAGC(bool enable) override {
507 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; 521 LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
508 RTC_CHECK(BuiltInAGCIsAvailable()) << "HW AGC is not available"; 522 RTC_CHECK(BuiltInAGCIsAvailable()) << "HW AGC is not available";
509 return input_.EnableBuiltInAGC(enable); 523 return input_.EnableBuiltInAGC(enable);
510 } 524 }
511 525
512 // Returns true if the device both supports built in NS and the device 526 // Returns true if the device both supports built in NS and the device
513 // is not blacklisted. 527 // is not blacklisted.
528 // TODO(henrika): add implementation for OpenSL ES based audio as well.
529 // In addition, see comments for BuiltInAECIsAvailable().
514 bool BuiltInNSIsAvailable() const override { 530 bool BuiltInNSIsAvailable() const override {
515 LOG(INFO) << __FUNCTION__; 531 LOG(INFO) << __FUNCTION__;
516 return audio_manager_->IsNoiseSuppressorSupported(); 532 return audio_manager_->IsNoiseSuppressorSupported();
517 } 533 }
518 534
535 // TODO(henrika): add implementation for OpenSL ES based audio as well.
519 int32_t EnableBuiltInNS(bool enable) override { 536 int32_t EnableBuiltInNS(bool enable) override {
520 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; 537 LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
521 RTC_CHECK(BuiltInNSIsAvailable()) << "HW NS is not available"; 538 RTC_CHECK(BuiltInNSIsAvailable()) << "HW NS is not available";
522 return input_.EnableBuiltInNS(enable); 539 return input_.EnableBuiltInNS(enable);
523 } 540 }
524 541
525 private: 542 private:
526 rtc::ThreadChecker thread_checker_; 543 rtc::ThreadChecker thread_checker_;
527 544
528 // Local copy of the audio layer set during construction of the 545 // Local copy of the audio layer set during construction of the
529 // AudioDeviceModuleImpl instance. Read only value. 546 // AudioDeviceModuleImpl instance. Read only value.
530 const AudioDeviceModule::AudioLayer audio_layer_; 547 const AudioDeviceModule::AudioLayer audio_layer_;
531 548
532 // Non-owning raw pointer to AudioManager instance given to use at 549 // Non-owning raw pointer to AudioManager instance given to use at
533 // construction. The real object is owned by AudioDeviceModuleImpl and the 550 // construction. The real object is owned by AudioDeviceModuleImpl and the
534 // life time is the same as that of the AudioDeviceModuleImpl, hence there 551 // life time is the same as that of the AudioDeviceModuleImpl, hence there
535 // is no risk of reading a NULL pointer at any time in this class. 552 // is no risk of reading a NULL pointer at any time in this class.
536 AudioManager* const audio_manager_; 553 AudioManager* const audio_manager_;
537 554
538 OutputType output_; 555 OutputType output_;
539 556
540 InputType input_; 557 InputType input_;
541 558
542 bool initialized_; 559 bool initialized_;
543 }; 560 };
544 561
545 } // namespace webrtc 562 } // namespace webrtc
546 563
547 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ 564 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/BUILD.gn ('k') | webrtc/modules/audio_device/android/audio_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698