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}
This commit is contained in:
parent
95d9851a6c
commit
c1316a1e51
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user