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

Unified Diff: webrtc/modules/audio_processing/high_pass_filter_impl.cc

Issue 1525983003: Fix HPF initialization behavior. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/high_pass_filter_impl.cc
diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc
index 0db794f94ef04cdb486fa973fbd133915ff878d3..facf1e471651b7a9a4453238fbdfa2b91ed5d0bd 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698