Add Config option to enable 48kHz support in AudioProcessing

BUG=webrtc:3146
R=andrew@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/45389004

Cr-Commit-Position: refs/heads/master@{#8563}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8563 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
aluebs@webrtc.org 2015-03-02 20:07:31 +00:00
parent 0482d01902
commit c9ce07ed87
3 changed files with 16 additions and 2 deletions

View File

@ -191,7 +191,8 @@ AudioProcessingImpl::AudioProcessingImpl(const Config& config,
transient_suppressor_enabled_(config.Get<ExperimentalNs>().enabled), transient_suppressor_enabled_(config.Get<ExperimentalNs>().enabled),
beamformer_enabled_(config.Get<Beamforming>().enabled), beamformer_enabled_(config.Get<Beamforming>().enabled),
beamformer_(beamformer), beamformer_(beamformer),
array_geometry_(config.Get<Beamforming>().array_geometry) { array_geometry_(config.Get<Beamforming>().array_geometry),
supports_48kHz_(config.Get<AudioProcessing48kHzSupport>().enabled) {
echo_cancellation_ = new EchoCancellationImpl(this, crit_); echo_cancellation_ = new EchoCancellationImpl(this, crit_);
component_list_.push_back(echo_cancellation_); component_list_.push_back(echo_cancellation_);
@ -353,7 +354,9 @@ int AudioProcessingImpl::InitializeLocked(int input_sample_rate_hz,
// We process at the closest native rate >= min(input rate, output rate)... // We process at the closest native rate >= min(input rate, output rate)...
int min_proc_rate = std::min(fwd_in_format_.rate(), fwd_out_format_.rate()); int min_proc_rate = std::min(fwd_in_format_.rate(), fwd_out_format_.rate());
int fwd_proc_rate; int fwd_proc_rate;
if (min_proc_rate > kSampleRate16kHz) { if (supports_48kHz_ && min_proc_rate > kSampleRate32kHz) {
fwd_proc_rate = kSampleRate48kHz;
} else if (min_proc_rate > kSampleRate16kHz) {
fwd_proc_rate = kSampleRate32kHz; fwd_proc_rate = kSampleRate32kHz;
} else if (min_proc_rate > kSampleRate8kHz) { } else if (min_proc_rate > kSampleRate8kHz) {
fwd_proc_rate = kSampleRate16kHz; fwd_proc_rate = kSampleRate16kHz;

View File

@ -222,6 +222,8 @@ class AudioProcessingImpl : public AudioProcessing {
const bool beamformer_enabled_; const bool beamformer_enabled_;
rtc::scoped_ptr<Beamformer> beamformer_; rtc::scoped_ptr<Beamformer> beamformer_;
const std::vector<Point> array_geometry_; const std::vector<Point> array_geometry_;
const bool supports_48kHz_;
}; };
} // namespace webrtc } // namespace webrtc

View File

@ -105,6 +105,15 @@ struct Beamforming {
const std::vector<Point> array_geometry; const std::vector<Point> array_geometry;
}; };
// Use to enable 48kHz support in audio processing. Must be provided through the
// constructor. It will have no impact if used with
// AudioProcessing::SetExtraOptions().
struct AudioProcessing48kHzSupport {
AudioProcessing48kHzSupport() : enabled(false) {}
explicit AudioProcessing48kHzSupport(bool enabled) : enabled(enabled) {}
bool enabled;
};
static const int kAudioProcMaxNativeSampleRateHz = 32000; static const int kAudioProcMaxNativeSampleRateHz = 32000;
// The Audio Processing Module (APM) provides a collection of voice processing // The Audio Processing Module (APM) provides a collection of voice processing