Bug 1114348 - Use mozilla::IsNaN() in Web Audio code; r=padenot

--HG--
extra : rebase_source : 0acc0643ed6a8800d02557f6e84312955e34a59e
This commit is contained in:
Ehsan Akhgari 2014-12-22 08:54:55 -05:00
parent 35b8e4d189
commit b7f57788cf
2 changed files with 4 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include "AudioBufferSourceNode.h"
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
#include "mozilla/dom/AudioParam.h"
#include "mozilla/FloatingPoint.h"
#include "nsMathUtils.h"
#include "AudioNodeEngine.h"
#include "AudioNodeStream.h"
@ -110,7 +111,7 @@ public:
mBeginProcessing = mStart + 0.5;
break;
case AudioBufferSourceNode::DOPPLERSHIFT:
mDopplerShift = aParam > 0 && aParam == aParam ? aParam : 1.0;
mDopplerShift = (aParam <= 0 || mozilla::IsNaN(aParam)) ? 1.0 : aParam;
break;
default:
NS_ERROR("Bad AudioBufferSourceNodeEngine double parameter.");
@ -415,7 +416,7 @@ public:
} else {
playbackRate = mPlaybackRateTimeline.GetValueAtTime(mSource->GetCurrentPosition());
}
if (playbackRate <= 0 || playbackRate != playbackRate) {
if (playbackRate <= 0 || mozilla::IsNaN(playbackRate)) {
playbackRate = 1.0f;
}

View File

@ -181,7 +181,7 @@ namespace WebAudioUtils {
static_assert(mozilla::IsFloatingPoint<FloatType>::value == true,
"FloatType must be a floating point type");
if (f != f) {
if (mozilla::IsNaN(f)) {
// It is the responsibility of the caller to deal with NaN values.
// If we ever get to this point, we have a serious bug to fix.
NS_RUNTIMEABORT("We should never see a NaN here");