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

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

Issue 1729783002: Don't clip FFT output values to minDecibels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/RealtimeAnalyser.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp
index ff7391073ad8586563c8ffc925091ef87a510da6..c27b6a3f4a6927bde406e8338d47102843675025 100644
--- a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp
@@ -192,7 +192,6 @@ void RealtimeAnalyser::getFloatFrequencyData(DOMFloat32Array* destinationArray)
doFFTAnalysis();
// Convert from linear magnitude to floating-point decibels.
- const double minDecibels = m_minDecibels;
unsigned sourceLength = magnitudeBuffer().size();
size_t len = std::min(sourceLength, destinationArray->length());
if (len > 0) {
@@ -201,7 +200,7 @@ void RealtimeAnalyser::getFloatFrequencyData(DOMFloat32Array* destinationArray)
for (unsigned i = 0; i < len; ++i) {
float linearValue = source[i];
- double dbMag = !linearValue ? minDecibels : AudioUtilities::linearToDecibels(linearValue);
+ double dbMag = AudioUtilities::linearToDecibels(linearValue);
destination[i] = float(dbMag);
}
}
@@ -226,7 +225,7 @@ void RealtimeAnalyser::getByteFrequencyData(DOMUint8Array* destinationArray)
for (unsigned i = 0; i < len; ++i) {
float linearValue = source[i];
- double dbMag = !linearValue ? minDecibels : AudioUtilities::linearToDecibels(linearValue);
+ double dbMag = AudioUtilities::linearToDecibels(linearValue);
// The range m_minDecibels to m_maxDecibels will be scaled to byte values from 0 to UCHAR_MAX.
double scaledValue = UCHAR_MAX * (dbMag - minDecibels) * rangeScaleFactor;

Powered by Google App Engine
This is Rietveld 408576698