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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h

Issue 1967393002: [DO NOT SUBMIT] AudioWorklet FS2: audio thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FS1-audioworklet-script-importing
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698