diff --git a/dom/media/webaudio/ThreeDPoint.h b/dom/media/webaudio/ThreeDPoint.h index b6d51e69a32c..71a2dad65523 100644 --- a/dom/media/webaudio/ThreeDPoint.h +++ b/dom/media/webaudio/ThreeDPoint.h @@ -36,6 +36,11 @@ struct ThreeDPoint final void Normalize() { + // Zero vectors cannot be normalized. For our purpose, normalizing a zero + // vector results in a zero vector. + if (IsZero()) { + return; + } // Normalize with the maximum norm first to avoid overflow and underflow. double invMax = 1 / MaxNorm(); x *= invMax; diff --git a/dom/media/webaudio/test/mochitest.ini b/dom/media/webaudio/test/mochitest.ini index acfdd056e2a6..4345d79cfead 100644 --- a/dom/media/webaudio/test/mochitest.ini +++ b/dom/media/webaudio/test/mochitest.ini @@ -100,6 +100,7 @@ tags=capturestream skip-if = toolkit == 'android' # bug 1056706 [test_bug1255618.html] [test_bug1267579.html] +[test_bug1355798.html] [test_channelMergerNode.html] [test_channelMergerNodeWithVolume.html] [test_channelSplitterNode.html] diff --git a/dom/media/webaudio/test/test_bug1355798.html b/dom/media/webaudio/test/test_bug1355798.html new file mode 100644 index 000000000000..01909f176b4e --- /dev/null +++ b/dom/media/webaudio/test/test_bug1355798.html @@ -0,0 +1,30 @@ + + + + Test PannerNode produces output even when the even when the distance is + from the listener is zero, and the cone gain is present, regression test for + bug 1355798. + + + + + +
+
+
+ +