Bug 1152359 - Fix doppler shift calculation formula. r=padenot
authorBoris Egorov <egorov@linux.com>
Wed, 08 Apr 2015 21:18:54 +0600
changeset 268157 fa63bc4130b978dfd5e2d3dbf575475cd1993467
parent 268156 7fc52c48e6e315c9a662b6fac639b320b0790cab
child 268158 baaa01bb29bb54b3e83ba72d3939cab243ad4f88
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1152359
milestone40.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 1152359 - Fix doppler shift calculation formula. r=padenot
dom/media/webaudio/PannerNode.cpp
--- a/dom/media/webaudio/PannerNode.cpp
+++ b/dom/media/webaudio/PannerNode.cpp
@@ -490,17 +490,17 @@ PannerNode::ComputeDopplerShift()
       double sourceListenerMagnitude = sourceToListener.Magnitude();
 
       double listenerProjection = sourceToListener.DotProduct(listener->Velocity()) / sourceListenerMagnitude;
       double sourceProjection = sourceToListener.DotProduct(mVelocity) / sourceListenerMagnitude;
 
       listenerProjection = -listenerProjection;
       sourceProjection = -sourceProjection;
 
-      double scaledSpeedOfSound = listener->DopplerFactor() / listener->DopplerFactor();
+      double scaledSpeedOfSound = listener->SpeedOfSound() / listener->DopplerFactor();
       listenerProjection = min(listenerProjection, scaledSpeedOfSound);
       sourceProjection = min(sourceProjection, scaledSpeedOfSound);
 
       dopplerShift = ((listener->SpeedOfSound() - listener->DopplerFactor() * listenerProjection) / (listener->SpeedOfSound() - listener->DopplerFactor() * sourceProjection));
 
       WebAudioUtils::FixNaN(dopplerShift); // Avoid illegal values
 
       // Limit the pitch shifting to 4 octaves up and 3 octaves down.