Bug 1498465 [wpt PR 13477] - Compute azimuth correctly according to the spec, a=testonly
authorRaymond Toy <rtoy@chromium.org>
Fri, 01 Feb 2019 13:41:03 +0000
changeset 458188 cb00507d73b65c7b7c86b53aac143e92476f84ab
parent 458187 ddd2c617156919691f0f18bd1064497c44f73ea2
child 458189 8e798a6a25cbf180a60e48615cdfe7c7f5ac2564
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1498465, 13477, 893983, 1277666, 626665
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1498465 [wpt PR 13477] - Compute azimuth correctly according to the spec, a=testonly Automatic update from web-platform-tests Compute azimuth correctly according to the spec The azimuth calculation is incorrect if one of the vectors is the zero vector. The spec handles this case correctly by just using the dot product alone with "normalized" vectors instead of trying to divide the dot product by the lengths. Bug: 893983 Test: panner-azimuth.html Change-Id: I7f890ae3353a71ffccfc3138038572a8a18b2379 Reviewed-on: https://chromium-review.googlesource.com/c/1277666 Commit-Queue: Raymond Toy <rtoy@chromium.org> Reviewed-by: Hongchan Choi <hongchan@chromium.org> Cr-Commit-Position: refs/heads/master@{#626665} -- wpt-commits: f2b7361daff0d555c271f8ffa50dc22ac8e948c5 wpt-pr: 13477
testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html
testing/web-platform/tests/webaudio/the-audio-api/the-pannernode-interface/panner-azimuth.html
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner.html
@@ -126,26 +126,30 @@
         src.connect(panner).connect(context.destination);
 
         src.start();
 
         let listener = context.listener;
 
         // Set listener properties to "random" values so that motion on one of
         // the attributes actually changes things relative to the panner
-        // location.
+        // location.  And the up and forward directions should have a simple
+        // relationship between them.
         listener.positionX.value = -1;
         listener.positionY.value = 1;
         listener.positionZ.value = -1;
         listener.forwardX.value = -1;
         listener.forwardY.value = 1;
         listener.forwardZ.value = -1;
+        // Make the up vector not parallel or perpendicular to the forward and
+        // position vectors so that automations of the up vector produce
+        // noticeable differences.
         listener.upX.value = 1;
         listener.upY.value = 1;
-        listener.upZ.value = 1;
+        listener.upZ.value = 2;
 
         let audioParam = listener[options.param];
         audioParam.automationRate = 'k-rate';
 
         let prefix = `Listener ${options.param}`;
         should(audioParam.automationRate, prefix + '.automationRate')
             .beEqualTo('k-rate');
         should(() => {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-pannernode-interface/panner-azimuth.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Test Panner Azimuth Calculation</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="../../resources/audit.js"></script>
+  </head>
+
+  <body>
+    <script>
+      const audit = Audit.createTaskRunner();
+
+      // Fairly arbitrary sample rate
+      const sampleRate = 16000;
+
+      audit.define('Azimuth calculation', (task, should) => {
+        // Two channels for the context so we can see each channel of the
+        // panner node.
+        let context = new OfflineAudioContext(2, sampleRate, sampleRate);
+
+        let src = new ConstantSourceNode(context);
+        let panner = new PannerNode(context);
+
+        src.connect(panner).connect(context.destination);
+
+        // The source is still pointed directly at the listener, but is now
+        // directly above.  The audio should be the same in both the left and
+        // right channels.
+        panner.positionY.value = 1;
+
+        src.start();
+
+        context.startRendering()
+            .then(audioBuffer => {
+              // The left and right channels should contain the same signal.
+              let c0 = audioBuffer.getChannelData(0);
+              let c1 = audioBuffer.getChannelData(1);
+
+              let expected = Math.fround(Math.SQRT1_2);
+
+              should(c0, 'Left channel').beConstantValueOf(expected);
+              should(c1, 'Righteft channel').beConstantValueOf(expected);
+            })
+            .then(() => task.done());
+      });
+
+      audit.run();
+    </script>
+  </body>
+</html>