Bug 1436096 - PannerNode noop optimization for equal power is valid on stereo source. r?padenot draft
authorAlex Chronopoulos <achronop@gmail.com>
Fri, 02 Mar 2018 20:47:34 +0200
changeset 762605 7d89df751ed6f129e2ea156a8ac3fc1b50e0f540
parent 762604 76bbeb9f51ace6943f1170c110187bf3823c5eb4
child 762606 9c436b3aa8377965c39e0807f5aabb1b25b2dbd3
push id101221
push userachronop@gmail.com
push dateFri, 02 Mar 2018 19:09:41 +0000
reviewerspadenot
bugs1436096
milestone60.0a1
Bug 1436096 - PannerNode noop optimization for equal power is valid on stereo source. r?padenot MozReview-Commit-ID: FwDYQyqr4wr
dom/media/webaudio/PannerNode.cpp
--- a/dom/media/webaudio/PannerNode.cpp
+++ b/dom/media/webaudio/PannerNode.cpp
@@ -472,19 +472,20 @@ PannerNodeEngine::EqualPowerPanningFunct
       mOrientationZ.HasSimpleValue()) {
 
     ThreeDPoint position = ConvertAudioParamTimelineTo3DP(mPositionX, mPositionY, mPositionZ, tick);
     ThreeDPoint orientation = ConvertAudioParamTimelineTo3DP(mOrientationX, mOrientationY, mOrientationZ, tick);
     if (!orientation.IsZero()) {
       orientation.Normalize();
     }
 
-    // If both the listener are in the same spot, and no cone gain is specified,
-    // this node is noop.
-    if (mListenerPosition ==  position &&
+    // For a stereo source, when both the listener and the panner are in
+    // the same spot, and no cone gain is specified, this node is noop.
+    if (inputChannels == 2 &&
+        mListenerPosition ==  position &&
         mConeInnerAngle == 360 &&
         mConeOuterAngle == 360) {
       *aOutput = aInput;
       return;
     }
 
     // The output of this node is always stereo, no matter what the inputs are.
     aOutput->AllocateChannels(2);