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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 2554823002: Change to use the new API in the audio processing module for enabling the high-pass filter effect (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | content/renderer/media/media_stream_audio_processor_options.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_audio_processor.h" 5 #include "content/renderer/media/media_stream_audio_processor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 if (GetStartupMinVolumeForAgc(&startup_min_volume)) { 624 if (GetStartupMinVolumeForAgc(&startup_min_volume)) {
625 config.Set<webrtc::ExperimentalAgc>( 625 config.Set<webrtc::ExperimentalAgc>(
626 new webrtc::ExperimentalAgc(true, startup_min_volume)); 626 new webrtc::ExperimentalAgc(true, startup_min_volume));
627 } 627 }
628 } 628 }
629 629
630 // Create and configure the webrtc::AudioProcessing. 630 // Create and configure the webrtc::AudioProcessing.
631 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); 631 audio_processing_.reset(webrtc::AudioProcessing::Create(config));
632 632
633 // Enable the audio processing components. 633 // Enable the audio processing components.
634 webrtc::AudioProcessing::Config apm_config;
635
634 if (echo_cancellation) { 636 if (echo_cancellation) {
635 EnableEchoCancellation(audio_processing_.get()); 637 EnableEchoCancellation(audio_processing_.get());
636 638
637 if (playout_data_source_) 639 if (playout_data_source_)
638 playout_data_source_->AddPlayoutSink(this); 640 playout_data_source_->AddPlayoutSink(this);
639 641
640 // Prepare for logging echo information. If there are data remaining in 642 // Prepare for logging echo information. If there are data remaining in
641 // |echo_information_| we simply discard it. 643 // |echo_information_| we simply discard it.
642 echo_information_.reset(new EchoInformation()); 644 echo_information_.reset(new EchoInformation());
643 } 645 }
644 646
645 if (goog_ns) { 647 if (goog_ns) {
646 // The beamforming postfilter is effective at suppressing stationary noise, 648 // The beamforming postfilter is effective at suppressing stationary noise,
647 // so reduce the single-channel NS aggressiveness when enabled. 649 // so reduce the single-channel NS aggressiveness when enabled.
648 const NoiseSuppression::Level ns_level = 650 const NoiseSuppression::Level ns_level =
649 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow 651 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow
650 : NoiseSuppression::kHigh; 652 : NoiseSuppression::kHigh;
651 653
652 EnableNoiseSuppression(audio_processing_.get(), ns_level); 654 EnableNoiseSuppression(audio_processing_.get(), ns_level);
653 } 655 }
654 656
655 if (goog_high_pass_filter) 657 apm_config.high_pass_filter.enabled = goog_high_pass_filter;
656 EnableHighPassFilter(audio_processing_.get());
657 658
658 if (goog_typing_detection) { 659 if (goog_typing_detection) {
659 // TODO(xians): Remove this |typing_detector_| after the typing suppression 660 // TODO(xians): Remove this |typing_detector_| after the typing suppression
660 // is enabled by default. 661 // is enabled by default.
661 typing_detector_.reset(new webrtc::TypingDetection()); 662 typing_detector_.reset(new webrtc::TypingDetection());
662 EnableTypingDetection(audio_processing_.get(), typing_detector_.get()); 663 EnableTypingDetection(audio_processing_.get(), typing_detector_.get());
663 } 664 }
664 665
665 if (goog_agc) 666 if (goog_agc)
666 EnableAutomaticGainControl(audio_processing_.get()); 667 EnableAutomaticGainControl(audio_processing_.get());
667 668
669 audio_processing_->ApplyConfig(apm_config);
670
668 RecordProcessingState(AUDIO_PROCESSING_ENABLED); 671 RecordProcessingState(AUDIO_PROCESSING_ENABLED);
669 } 672 }
670 673
671 void MediaStreamAudioProcessor::InitializeCaptureFifo( 674 void MediaStreamAudioProcessor::InitializeCaptureFifo(
672 const media::AudioParameters& input_format) { 675 const media::AudioParameters& input_format) {
673 DCHECK(main_thread_runner_->BelongsToCurrentThread()); 676 DCHECK(main_thread_runner_->BelongsToCurrentThread());
674 DCHECK(input_format.IsValid()); 677 DCHECK(input_format.IsValid());
675 input_format_ = input_format; 678 input_format_ = input_format;
676 679
677 // TODO(ajm): For now, we assume fixed parameters for the output when audio 680 // TODO(ajm): For now, we assume fixed parameters for the output when audio
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 0 : agc->stream_analog_level(); 829 0 : agc->stream_analog_level();
827 } 830 }
828 831
829 void MediaStreamAudioProcessor::UpdateAecStats() { 832 void MediaStreamAudioProcessor::UpdateAecStats() {
830 DCHECK(main_thread_runner_->BelongsToCurrentThread()); 833 DCHECK(main_thread_runner_->BelongsToCurrentThread());
831 if (echo_information_) 834 if (echo_information_)
832 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); 835 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation());
833 } 836 }
834 837
835 } // namespace content 838 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_audio_processor_options.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698