Bug 1122218 - Fix off-by-one error when computing oscillator rendering range. r=karlt, a=sledru
authorPaul Adenot <paul@paul.cx>
Wed, 13 May 2015 11:02:27 +0200
changeset 266124 befc7b294081
parent 266123 081397fd519a
child 266125 a8c1768e0d87
push id4762
push userryanvm@gmail.com
push date2015-05-28 18:54 +0000
treeherdermozilla-beta@dc9c305024f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, sledru
bugs1122218
milestone39.0
Bug 1122218 - Fix off-by-one error when computing oscillator rendering range. r=karlt, a=sledru
dom/media/test/crashtests/1122218.html
dom/media/test/crashtests/crashtests.list
dom/media/webaudio/OscillatorNode.cpp
new file mode 100644
--- /dev/null
+++ b/dom/media/test/crashtests/1122218.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+function boom() {
+  var r0=new AudioContext();
+
+  var cm=r0.createChannelMerger(20);
+
+  var o1=r0.createOscillator();
+  var o2=r0.createOscillator();
+
+  var pw=r0.createPeriodicWave(new Float32Array(4),new Float32Array(4));
+  o2.setPeriodicWave(pw);
+
+  o1.connect(cm);
+  cm.connect(o2.frequency);
+
+  o1.start();
+  o2.start(0.476);
+}
+</script>
+</head>
+<body onload="boom();"></body>
+</html>
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -70,12 +70,13 @@ load 990794.html
 load 1015662.html
 skip-if(Android||B2G) test-pref(media.navigator.permission.disabled,true) load 1028458.html # bug 1048863
 load buffer-source-ended-1.html
 HTTP load media-element-source-seek-1.html
 load offline-buffer-source-ended-1.html
 load oscillator-ended-1.html
 load oscillator-ended-2.html
 load 1080986.html
+load 1122218.html
 include ../../mediasource/test/crashtests/crashtests.list
 
 # This needs to run at the end to avoid leaking busted state into other tests.
 skip-if(B2G||winWidget||OSX==1006||OSX==1010&&isDebugBuild) load 691096-1.html
--- a/dom/media/webaudio/OscillatorNode.cpp
+++ b/dom/media/webaudio/OscillatorNode.cpp
@@ -298,17 +298,17 @@ public:
     }
 
     if (ticks >= mStop) {
       // We've finished playing.
       ComputeSilence(aOutput);
       *aFinished = true;
       return;
     }
-    if (ticks + WEBAUDIO_BLOCK_SIZE < mStart) {
+    if (ticks + WEBAUDIO_BLOCK_SIZE <= mStart) {
       // We're not playing yet.
       ComputeSilence(aOutput);
       return;
     }
 
     AllocateAudioBlock(1, aOutput);
     float* output = static_cast<float*>(
         const_cast<void*>(aOutput->mChannelData[0]));