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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html

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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html b/third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html
new file mode 100644
index 0000000000000000000000000000000000000000..3c12bda7fdc8b0f49299208a35eb5fbdaa03091b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+ <head>
+ <script src="../resources/js-test.js"></script>
+ <script src="resources/compatibility.js"></script>
+ <script src="resources/audio-testing.js"></script>
+ <title>Test getFloatFrequencyData With Zero Inputs</title>
+ </head>
+
+ <body>
+ <script>
+ description("Test AnalyserNode getFloatFrequencyData With Zero-Valued Input");
+ window.jsTestIsAsync = true;
+
+ var sampleRate = 48000;
+
+ // Render enough data to run the test.
+ var renderFrames = 2*1024;
+ var renderDuration = renderFrames / sampleRate;
+
+ var audit = Audit.createTaskRunner();
+
+
+ // Test that getFloatFrequencyData returns -Infinity when the input is all-zeroes.
+ audit.defineTask("zero input", function (done) {
+ var context = new OfflineAudioContext(1, renderFrames, sampleRate);
+
+ // Constant source of 0's.
+ var source = context.createBufferSource();
+ source.buffer = createConstantBuffer(context, 1, 0);
+ source.loop = true;
+
+ // Create analyser and use some non-default minDecibels value.
+ var analyser = context.createAnalyser();
+ analyser.minDecibels = -123;
+
+ source.connect(analyser);
+ analyser.connect(context.destination);
+
+ source.start();
+
+ // Suspend after some number of frames and grab the float frequency data.
+ context.suspend(1024 / sampleRate).then(function () {
+ var f = new Float32Array(analyser.frequencyBinCount);
+ analyser.getFloatFrequencyData(f);
+
+ Should("getFloatFrequencyData() with zero-valued input", f)
+ .beConstantValueOf(-Infinity);
+ }).then(context.resume.bind(context));
+
+ context.startRendering().then(done);
+ });
+
+ audit.defineTask("finish", function (done) {
+ finishJSTest();
+ done();
+ });
+
+ audit.runTasks();
+
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698