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

Unified Diff: LayoutTests/webaudio/scriptprocessornode.html

Issue 773273002: Update the current frame count in a safe place (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Modify test to allow 1 block delay. Created 6 years 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.h » ('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 e159e689df01d8bca697a4b6c9760ea5c440199e..c65ddc6fa62754c66f1640064280e7d2c6bea9f2 100644
--- a/LayoutTests/webaudio/scriptprocessornode.html
+++ b/LayoutTests/webaudio/scriptprocessornode.html
@@ -47,8 +47,17 @@ function processAudioData(event) {
// 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);
+ // since currentTime is continuously increasing on audio thread. And caching of the currentTime
+ // can cause playbackTime to be one block behind. So allow for that.
+
+ var closeEnough = Math.abs(playbackTime - expectedTime) <= allowedTimeGap;
+ closeEnough = closeEnough || (Math.abs(playbackTime - (expectedTime - 128 / context.sampleRate)) <= allowedTimeGap);
+
+ if (!closeEnough) {
+ testFailed("playbackTime should be within " + allowedTimeGap + " of either "
+ + expectedTime + " or " + (expectedTime - 128 / context.sampleRate)
+ + ". Was " + playbackTime);
+ }
buffer = event.outputBuffer;
if (buffer.numberOfChannels != outputChannels)
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698