aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules
diff options
context:
space:
mode:
authorsolenberg <solenberg@webrtc.org>2015-12-15 16:07:25 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-16 00:07:32 +0000
commitc1316a1e51231b717e335f2c4c5ed3bf860a42b3 (patch)
treedcc87eaed569bb05884699d840f64f9e90095956 /webrtc/modules
parent95d9851a6ca25208e4566dedeb149a6680c512a8 (diff)
downloadwebrtc-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.cc9
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;
}