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

Side by Side Diff: LayoutTests/webaudio/scriptprocessornode.html

Issue 1149913002: Access current frame counter carefully and remove m_cachedSampleFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove workaround in scriptprocessornode test Created 5 years, 7 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 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 28 matching lines...) Expand all
39 39
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 currentTi me when read in JS
50 // since currentTime is continuously increasing on audio thread. And cachin g of the currentTime 50 // since currentTime is continuously increasing on audio thread.
51 // can cause playbackTime to be one block behind. So allow for that.
52 51
53 var closeEnough = Math.abs(playbackTime - expectedTime) <= allowedTimeGap; 52 shouldBeCloseTo("playbackTime", expectedTime, allowedTimeGap, true);
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 }
61 53
62 buffer = event.outputBuffer; 54 buffer = event.outputBuffer;
63 if (buffer.numberOfChannels != outputChannels) 55 if (buffer.numberOfChannels != outputChannels)
64 testFailed("numberOfOutputChannels doesn't match!"); 56 testFailed("numberOfOutputChannels doesn't match!");
65 57
66 if (buffer.length != bufferSize) 58 if (buffer.length != bufferSize)
67 testFailed("numberOfOutputChannels doesn't match!"); 59 testFailed("numberOfOutputChannels doesn't match!");
68 60
69 buffer = event.inputBuffer; 61 buffer = event.inputBuffer;
70 var bufferDataL = buffer.getChannelData(0); 62 var bufferDataL = buffer.getChannelData(0);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 context.oncomplete = finishJSTest; 163 context.oncomplete = finishJSTest;
172 context.startRendering(); 164 context.startRendering();
173 } 165 }
174 166
175 runTest(); 167 runTest();
176 168
177 </script> 169 </script>
178 170
179 </body> 171 </body>
180 </html> 172 </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