| Index: third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h
|
| index a25e598b53617a89d01aa2b0466ae65ea470a49e..d12c52e2c5779b50a2e7fcb521f6e56b4a79836a 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h
|
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h
|
| @@ -41,12 +41,14 @@ public:
|
| AudioDestinationHandler(AudioNode&, float sampleRate);
|
| ~AudioDestinationHandler() override;
|
|
|
| - // AudioHandler
|
| - void process(size_t) final { } // we're pulled by hardware so this is never called
|
| + // Implements AudioHandler::process. However, this node is pulled by
|
| + // hardware isochronously so this is never called.
|
| + void process(size_t) final { }
|
|
|
| - // The audio hardware calls render() to get the next render quantum of audio into destinationBus.
|
| - // It will optionally give us local/live audio input in sourceBus (if it's not 0).
|
| - void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFrames) final;
|
| + // Implements AudioIOCallback::render. The audio hardware periodically calls
|
| + // render() to get the next render quantum of audio into the destination
|
| + // bus.
|
| + void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess) final;
|
|
|
| size_t currentSampleFrame() const { return acquireLoad(&m_currentSampleFrame); }
|
| double currentTime() const { return currentSampleFrame() / static_cast<double>(sampleRate()); }
|
| @@ -57,25 +59,30 @@ public:
|
| virtual void stopRendering() = 0;
|
|
|
| protected:
|
| - // LocalAudioInputProvider allows us to expose an AudioSourceProvider for local/live audio input.
|
| - // If there is local/live audio input, we call set() with the audio input data every render quantum.
|
| + // LocalAudioInputProvider allows us to expose an AudioSourceProvider for
|
| + // local/live audio input. If there is local/live audio input, we call set()
|
| + // with the audio input data every render quantum.
|
| class LocalAudioInputProvider final : public AudioSourceProvider {
|
| public:
|
| + // TODO(hongchan): handle non-stereo local input.
|
| LocalAudioInputProvider()
|
| - : m_sourceBus(AudioBus::create(2, ProcessingSizeInFrames)) // FIXME: handle non-stereo local input.
|
| + : m_sourceBus(AudioBus::create(2, ProcessingSizeInFrames))
|
| {
|
| }
|
|
|
| - void set(AudioBus* bus)
|
| + void setSourceBus(AudioBus* sourceBus)
|
| {
|
| - if (bus)
|
| - m_sourceBus->copyFrom(*bus);
|
| + if (sourceBus)
|
| + m_sourceBus->copyFrom(*sourceBus);
|
| }
|
|
|
| - // AudioSourceProvider.
|
| + // Implements AudioSourceProvider::provideInput.
|
| void provideInput(AudioBus* destinationBus, size_t numberOfFrames) override
|
| {
|
| - bool isGood = destinationBus && destinationBus->length() == numberOfFrames && m_sourceBus->length() == numberOfFrames;
|
| + bool isGood =
|
| + destinationBus && destinationBus->length() == numberOfFrames
|
| + && m_sourceBus->length() == numberOfFrames;
|
| +
|
| ASSERT(isGood);
|
| if (isGood)
|
| destinationBus->copyFrom(*m_sourceBus);
|
|
|