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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script> 5 <script src="resources/compatibility.js"></script>
6 <script type="text/javascript" src="resources/audio-testing.js"></script> 6 <script type="text/javascript" src="resources/audio-testing.js"></script>
7 </head> 7 </head>
8 8
9 <body> 9 <body>
10 10
(...skipping 29 matching lines...) Expand all
40 return audioBuffer; 40 return audioBuffer;
41 } 41 }
42 42
43 function processAudioData(event) { 43 function processAudioData(event) {
44 playbackTime = event.playbackTime; 44 playbackTime = event.playbackTime;
45 var expectedTime = context.currentTime + (bufferSize / context.sampleRate); 45 var expectedTime = context.currentTime + (bufferSize / context.sampleRate);
46 var allowedTimeGap = 0.0000001; 46 var allowedTimeGap = 0.0000001;
47 47
48 // There may be a little time gap which is from different thread operation 48 // There may be a little time gap which is from different thread operation
49 // between currentTime when main thread fires onaudioprocess() and currenTim e when read in JS 49 // between currentTime when main thread fires onaudioprocess() and currenTim e when read in JS
50 // since currentTime is continuously increasing on audio thread. 50 // since currentTime is continuously increasing on audio thread. And cachin g of the currentTime
51 shouldBeCloseTo("playbackTime", expectedTime, allowedTimeGap, true); 51 // can cause playbackTime to be one block behind. So allow for that.
52
53 var closeEnough = Math.abs(playbackTime - expectedTime) <= allowedTimeGap;
54 closeEnough = closeEnough || (Math.abs(playbackTime - (expectedTime - 128 / context.sampleRate)) <= allowedTimeGap);
55
56 if (!closeEnough) {
57 testFailed("playbackTime should be within " + allowedTimeGap + " of eith er "
58 + expectedTime + " or " + (expectedTime - 128 / context.sampl eRate)
59 + ". Was " + playbackTime);
60 }
52 61
53 buffer = event.outputBuffer; 62 buffer = event.outputBuffer;
54 if (buffer.numberOfChannels != outputChannels) 63 if (buffer.numberOfChannels != outputChannels)
55 testFailed("numberOfOutputChannels doesn't match!"); 64 testFailed("numberOfOutputChannels doesn't match!");
56 65
57 if (buffer.length != bufferSize) 66 if (buffer.length != bufferSize)
58 testFailed("numberOfOutputChannels doesn't match!"); 67 testFailed("numberOfOutputChannels doesn't match!");
59 68
60 buffer = event.inputBuffer; 69 buffer = event.inputBuffer;
61 var bufferDataL = buffer.getChannelData(0); 70 var bufferDataL = buffer.getChannelData(0);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 context.oncomplete = finishJSTest; 171 context.oncomplete = finishJSTest;
163 context.startRendering(); 172 context.startRendering();
164 } 173 }
165 174
166 runTest(); 175 runTest();
167 176
168 </script> 177 </script>
169 178
170 </body> 179 </body>
171 </html> 180 </html>
OLDNEW
« 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