Bug 1413256 - ConstantSourceNode.offset min/max values. Most-negative and most-positive single-float instead of -infinity/+infinity. r?padenot
MozReview-Commit-ID: USUW4tjgSD
--- a/dom/media/webaudio/ConstantSourceNode.cpp
+++ b/dom/media/webaudio/ConstantSourceNode.cpp
@@ -145,17 +145,19 @@ public:
};
ConstantSourceNode::ConstantSourceNode(AudioContext* aContext)
: AudioScheduledSourceNode(aContext,
1,
ChannelCountMode::Max,
ChannelInterpretation::Speakers)
, mOffset(new AudioParam(this, ConstantSourceNodeEngine::OFFSET,
- "offset", 1.0f))
+ "offset", 1.0f,
+ std::numeric_limits<float>::lowest(),
+ std::numeric_limits<float>::max()))
, mStartCalled(false)
{
ConstantSourceNodeEngine* engine = new ConstantSourceNodeEngine(this, aContext->Destination());
mStream = AudioNodeStream::Create(aContext, engine,
AudioNodeStream::NEED_MAIN_THREAD_FINISHED,
aContext->Graph());
engine->SetSourceStream(mStream);
mStream->AddMainThreadListener(this);
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -102,16 +102,17 @@ tags=capturestream
[test_bug1113634.html]
[test_bug1118372.html]
[test_bug1027864.html]
[test_bug1056032.html]
skip-if = toolkit == 'android' # bug 1056706
[test_bug1255618.html]
[test_bug1267579.html]
[test_bug1355798.html]
+[test_bug1413256.html]
[test_channelMergerNode.html]
[test_channelMergerNodeWithVolume.html]
[test_channelSplitterNode.html]
[test_channelSplitterNodeWithVolume.html]
skip-if = (android_version == '18' && debug) # bug 1158417
[test_convolverNode.html]
[test_convolverNode_mono_mono.html]
[test_convolverNodeChannelCount.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/test/test_bug1413256.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test offset.minValue and offset.maxValue are correct</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="webaudio.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+c = new AudioContext();
+n = new ConstantSourceNode(c);
+var min =-3.4028234663852886e+38;
+var max = 3.4028234663852886e+38;
+is(n.offset.minValue, min,"Sould be the most-negative single-float value");
+is(n.offset.maxValue, max,"Should be the most-positive single-float value");
+
+
+</script>
+</pre>
+</body>
+</html>
\ No newline at end of file