Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: LayoutTests/webaudio/scriptprocessornode.html

Issue 210973002: Supporting a playbackTime attribute on AudioprocessingEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698