Chromium Code Reviews| Index: LayoutTests/webaudio/scriptprocessornode.html |
| diff --git a/LayoutTests/webaudio/scriptprocessornode.html b/LayoutTests/webaudio/scriptprocessornode.html |
| index 2092d03792e474dc8564ed98e9cfc8f339cca565..e159e689df01d8bca697a4b6c9760ea5c440199e 100644 |
| --- a/LayoutTests/webaudio/scriptprocessornode.html |
| +++ b/LayoutTests/webaudio/scriptprocessornode.html |
| @@ -16,6 +16,7 @@ description("Tests ScriptProcessorNode."); |
| var sampleRate = 44100.0; |
| var outputChannels = 6; |
| +var playbackTime = 0.0; |
| // For the current implementation of ScriptProcessorNode, when it works with OfflineAudioContext (which runs much faster |
| // than real-time) the event.inputBuffer might be overwrite again before onaudioprocess ever get chance to be called. |
| @@ -40,6 +41,15 @@ function createBuffer(context, length) { |
| } |
| function processAudioData(event) { |
| + playbackTime = event.playbackTime; |
| + var expectedTime = context.currentTime + (bufferSize / context.sampleRate); |
| + var allowedTimeGap = 0.0000001; |
| + |
| + // There may be a little time gap which is from different thread operation |
| + // between currentTime when main thread fires onaudioprocess() and currenTime when read in JS |
| + // since currentTime is continuously increasing on audio thread. |
| + shouldBeCloseTo("playbackTime", expectedTime, allowedTimeGap, true); |
|
mickelsen.eric
2014/10/07 02:05:41
I'm not sure how to track this down, but I have a
|
| + |
| buffer = event.outputBuffer; |
| if (buffer.numberOfChannels != outputChannels) |
| testFailed("numberOfOutputChannels doesn't match!"); |
| @@ -50,7 +60,7 @@ function processAudioData(event) { |
| buffer = event.inputBuffer; |
| var bufferDataL = buffer.getChannelData(0); |
| var bufferDataR = buffer.getChannelData(1); |
| - |
| + |
| var success = true; |
| // Go through every sample and make sure it's all -1 for the left-channel, and all +1 for the right-channel. |
| for (var i = 0; i < buffer.length; ++i) { |