diff options
author | solenberg <solenberg@webrtc.org> | 2015-12-15 16:07:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-16 00:07:32 +0000 |
commit | c1316a1e51231b717e335f2c4c5ed3bf860a42b3 (patch) | |
tree | dcc87eaed569bb05884699d840f64f9e90095956 /webrtc/modules | |
parent | 95d9851a6ca25208e4566dedeb149a6680c512a8 (diff) | |
download | webrtc-c1316a1e51231b717e335f2c4c5ed3bf860a42b3.tar.gz |
Fix HPF initialization behavior. This was changed when removing the ProcessingComponent inheritance in https://codereview.webrtc.org/1490333004/.
BUG=webrtc:5298
Review URL: https://codereview.webrtc.org/1525983003
Cr-Commit-Position: refs/heads/master@{#11038}
Diffstat (limited to 'webrtc/modules')
-rw-r--r-- | webrtc/modules/audio_processing/high_pass_filter_impl.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc index 0db794f94e..facf1e4716 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.cc +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.cc @@ -26,6 +26,10 @@ class HighPassFilterImpl::BiquadFilter { ba_(sample_rate_hz == AudioProcessing::kSampleRate8kHz ? kFilterCoefficients8kHz : kFilterCoefficients) { + Reset(); + } + + void Reset() { std::memset(x_, 0, sizeof(x_)); std::memset(y_, 0, sizeof(y_)); } @@ -115,6 +119,11 @@ void HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) { int HighPassFilterImpl::Enable(bool enable) { rtc::CritScope cs(crit_); + if (!enabled_ && enable) { + for (auto& filter : filters_) { + filter->Reset(); + } + } enabled_ = enable; return AudioProcessing::kNoError; } |