Index: third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp |
index f5eea247a774b645966ee5b6ccb6e35cf9056108..1ffd1ce70908023bb6d76d67d36cc7910590408e 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp |
@@ -44,11 +44,11 @@ AudioDestinationHandler::~AudioDestinationHandler() |
ASSERT(!isInitialized()); |
} |
-void AudioDestinationHandler::render(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFrames) |
+void AudioDestinationHandler::render(AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess) |
{ |
- // We don't want denormals slowing down any of the audio processing |
- // since they can very seriously hurt performance. |
- // This will take care of all AudioNodes because they all process within this scope. |
+ // We don't want denormals slowing down any of the audio processing since |
+ // they can very seriously hurt performance. This will take care of all |
+ // AudioNodes because they all process within this scope. |
DenormalDisabler denormalDisabler; |
// Need to check if the context actually alive. Otherwise the subsequent |
@@ -71,37 +71,44 @@ void AudioDestinationHandler::render(AudioBus* sourceBus, AudioBus* destinationB |
return; |
} |
- // Let the context take care of any business at the start of each render quantum. |
+ // Let the context take care of any business at the start of each render |
+ // quantum. |
context()->handlePreRenderTasks(); |
// Prepare the local audio input provider for this render quantum. |
if (sourceBus) |
- m_localAudioInputProvider.set(sourceBus); |
+ m_localAudioInputProvider.setSourceBus(sourceBus); |
ASSERT(numberOfInputs() >= 1); |
if (numberOfInputs() < 1) { |
destinationBus->zero(); |
return; |
} |
- // This will cause the node(s) connected to us to process, which in turn will pull on their input(s), |
- // all the way backwards through the rendering graph. |
- AudioBus* renderedBus = input(0).pull(destinationBus, numberOfFrames); |
+ // This will cause the node(s) connected to us to process, which in turn |
+ // will pull on their input(s), all the way backwards through the rendering |
+ // graph. |
+ AudioBus* renderedBus = input(0).pull(destinationBus, framesToProcess); |
+ |
+ // TODO(hongchan): this logic should be a part of AudioNodeInput::pull(). |
if (!renderedBus) { |
destinationBus->zero(); |
} else if (renderedBus != destinationBus) { |
- // in-place processing was not possible - so copy |
+ // If the destination node has multiple inputs, in-place processing is |
+ // not possible. Thus the explicit copy is necessary. |
destinationBus->copyFrom(*renderedBus); |
} |
- // Process nodes which need a little extra help because they are not connected to anything, but still need to process. |
- context()->deferredTaskHandler().processAutomaticPullNodes(numberOfFrames); |
+ // Process nodes which need a little extra help because they are not |
+ // connected to anything, but still need to process. |
+ context()->deferredTaskHandler().processAutomaticPullNodes(framesToProcess); |
- // Let the context take care of any business at the end of each render quantum. |
+ // Let the context take care of any business at the end of each render |
+ // quantum. |
context()->handlePostRenderTasks(); |
// Advance current sample-frame. |
- size_t newSampleFrame = m_currentSampleFrame + numberOfFrames; |
+ size_t newSampleFrame = m_currentSampleFrame + framesToProcess; |
releaseStore(&m_currentSampleFrame, newSampleFrame); |
} |