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

Unified Diff: third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp

Issue 2919503002: Revert of Compute tail time from Biquad coefficients (Closed)
Patch Set: Created 3 years, 7 months 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
Index: third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
index e45539e60f03b6d33cdcb838976eb8a5658f2f6a..e5384a5606c81133918d0a94324a91ec930483aa 100644
--- a/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
@@ -31,6 +31,13 @@
namespace blink {
+// FIXME: As a recursive linear filter, depending on its parameters, a biquad
+// filter can have an infinite tailTime. In practice, Biquad filters do not
+// usually (except for very high resonance values) have a tailTime of longer
+// than approx. 200ms. This value could possibly be calculated based on the
+// settings of the Biquad.
+static const double kMaxBiquadDelayTime = 0.2;
+
void BiquadDSPKernel::UpdateCoefficientsIfNecessary(int frames_to_process) {
if (GetBiquadProcessor()->FilterCoefficientsDirty()) {
float cutoff_frequency[AudioUtilities::kRenderQuantumFrames];
@@ -114,23 +121,6 @@
break;
}
}
-
- UpdateTailTime(number_of_frames - 1);
-}
-
-void BiquadDSPKernel::UpdateTailTime(int coef_index) {
- // A reasonable upper limit for the tail time. While it's easy to
- // create biquad filters whose tail time can be much larger than
- // this, limit the maximum to this value so that we don't keep such
- // nodes alive "forever".
- // TODO: What is a reasonable upper limit?
- const double kMaxTailTime = 30;
-
- double sample_rate = SampleRate();
- double tail =
- biquad_.TailFrame(coef_index, kMaxTailTime * sample_rate) / sample_rate;
-
- tail_time_ = clampTo(tail, 0.0, kMaxTailTime);
}
void BiquadDSPKernel::Process(const float* source,
@@ -209,7 +199,7 @@
}
double BiquadDSPKernel::TailTime() const {
- return tail_time_;
+ return kMaxBiquadDelayTime;
}
double BiquadDSPKernel::LatencyTime() const {
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.h ('k') | third_party/WebKit/Source/platform/audio/Biquad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698