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

Side by Side Diff: Source/modules/webaudio/ScriptProcessorNode.cpp

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 | « Source/modules/webaudio/AudioContext.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (!outputBuffer) 252 if (!outputBuffer)
253 return; 253 return;
254 254
255 // Avoid firing the event if the document has already gone away. 255 // Avoid firing the event if the document has already gone away.
256 if (context()->executionContext()) { 256 if (context()->executionContext()) {
257 // This synchronizes with process(). 257 // This synchronizes with process().
258 MutexLocker processLocker(m_processEventLock); 258 MutexLocker processLocker(m_processEventLock);
259 259
260 // Calculate a playbackTime with the buffersize which needs to be proces sed each time onaudioprocess is called. 260 // Calculate a playbackTime with the buffersize which needs to be proces sed each time onaudioprocess is called.
261 // The outputBuffer being passed to JS will be played after exhuasting p revious outputBuffer by double-buffering. 261 // The outputBuffer being passed to JS will be played after exhuasting p revious outputBuffer by double-buffering.
262 double playbackTime = (context()->currentSampleFrame() + m_bufferSize) / static_cast<double>(context()->sampleRate()); 262 double playbackTime = (context()->cachedSampleFrame() + m_bufferSize) / static_cast<double>(context()->sampleRate());
263 263
264 // Call the JavaScript event handler which will do the audio processing. 264 // Call the JavaScript event handler which will do the audio processing.
265 dispatchEvent(AudioProcessingEvent::create(inputBuffer, outputBuffer, pl aybackTime)); 265 dispatchEvent(AudioProcessingEvent::create(inputBuffer, outputBuffer, pl aybackTime));
266 } 266 }
267 } 267 }
268 268
269 double ScriptProcessorNode::tailTime() const 269 double ScriptProcessorNode::tailTime() const
270 { 270 {
271 return std::numeric_limits<double>::infinity(); 271 return std::numeric_limits<double>::infinity();
272 } 272 }
(...skipping 30 matching lines...) Expand all
303 void ScriptProcessorNode::trace(Visitor* visitor) 303 void ScriptProcessorNode::trace(Visitor* visitor)
304 { 304 {
305 visitor->trace(m_inputBuffers); 305 visitor->trace(m_inputBuffers);
306 visitor->trace(m_outputBuffers); 306 visitor->trace(m_outputBuffers);
307 AudioNode::trace(visitor); 307 AudioNode::trace(visitor);
308 } 308 }
309 309
310 } // namespace blink 310 } // namespace blink
311 311
312 #endif // ENABLE(WEB_AUDIO) 312 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698