Commit cdc95273 authored by Hongchan Choi's avatar Hongchan Choi Committed by Commit Bot

Remove LocalAudioSourceProvider from AudioDestinationNode

The class and its feature is not being used in the class at all. It
also removes redundant the "input" buffer from the render call chain.

Bug: 854229
Change-Id: I4d7ff0142a2548391b739d9d5194365b5acad98d
Reviewed-on: https://chromium-review.googlesource.com/1108439
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569081}
parent 40d02af1
...@@ -43,8 +43,7 @@ AudioDestinationHandler::~AudioDestinationHandler() { ...@@ -43,8 +43,7 @@ AudioDestinationHandler::~AudioDestinationHandler() {
DCHECK(!IsInitialized()); DCHECK(!IsInitialized());
} }
void AudioDestinationHandler::Render(AudioBus* source_bus, void AudioDestinationHandler::Render(AudioBus* destination_bus,
AudioBus* destination_bus,
size_t number_of_frames, size_t number_of_frames,
const AudioIOPosition& output_position) { const AudioIOPosition& output_position) {
TRACE_EVENT0("webaudio", "AudioDestinationHandler::Render"); TRACE_EVENT0("webaudio", "AudioDestinationHandler::Render");
...@@ -78,10 +77,6 @@ void AudioDestinationHandler::Render(AudioBus* source_bus, ...@@ -78,10 +77,6 @@ void AudioDestinationHandler::Render(AudioBus* source_bus,
// quantum. // quantum.
Context()->HandlePreRenderTasks(output_position); Context()->HandlePreRenderTasks(output_position);
// Prepare the local audio input provider for this render quantum.
if (source_bus)
local_audio_input_provider_.Set(source_bus);
DCHECK_GE(NumberOfInputs(), 1u); DCHECK_GE(NumberOfInputs(), 1u);
if (NumberOfInputs() < 1) { if (NumberOfInputs() < 1) {
destination_bus->Zero(); destination_bus->Zero();
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "third_party/blink/renderer/modules/webaudio/audio_node.h" #include "third_party/blink/renderer/modules/webaudio/audio_node.h"
#include "third_party/blink/renderer/platform/audio/audio_bus.h" #include "third_party/blink/renderer/platform/audio/audio_bus.h"
#include "third_party/blink/renderer/platform/audio/audio_io_callback.h" #include "third_party/blink/renderer/platform/audio/audio_io_callback.h"
#include "third_party/blink/renderer/platform/audio/audio_source_provider.h"
namespace blink { namespace blink {
...@@ -46,11 +45,9 @@ class AudioDestinationHandler : public AudioHandler, public AudioIOCallback { ...@@ -46,11 +45,9 @@ class AudioDestinationHandler : public AudioHandler, public AudioIOCallback {
void Process(size_t) final { void Process(size_t) final {
} // we're pulled by hardware so this is never called } // we're pulled by hardware so this is never called
// The audio hardware calls render() to get the next render quantum of audio // Invoked by the AudioDestination to get the next render quantum into
// into destinationBus. It will optionally give us local/live audio input in // |destination_bus|.
// sourceBus (if it's not 0). void Render(AudioBus* destination_bus,
void Render(AudioBus* source_bus,
AudioBus* destination_bus,
size_t number_of_frames, size_t number_of_frames,
const AudioIOPosition& output_position) final; const AudioIOPosition& output_position) final;
...@@ -79,42 +76,8 @@ class AudioDestinationHandler : public AudioHandler, public AudioIOCallback { ...@@ -79,42 +76,8 @@ class AudioDestinationHandler : public AudioHandler, public AudioIOCallback {
virtual int FramesPerBuffer() const = 0; virtual int FramesPerBuffer() const = 0;
protected: 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.
class LocalAudioInputProvider final : public AudioSourceProvider {
public:
LocalAudioInputProvider()
: source_bus_(AudioBus::Create(
2,
AudioUtilities::kRenderQuantumFrames)) // FIXME: handle
// non-stereo local input.
{}
void Set(AudioBus* bus) {
if (bus)
source_bus_->CopyFrom(*bus);
}
// AudioSourceProvider.
void ProvideInput(AudioBus* destination_bus,
size_t number_of_frames) override {
bool is_good = destination_bus &&
destination_bus->length() == number_of_frames &&
source_bus_->length() == number_of_frames;
DCHECK(is_good);
if (is_good)
destination_bus->CopyFrom(*source_bus_);
}
private:
scoped_refptr<AudioBus> source_bus_;
};
// Counts the number of sample-frames processed by the destination. // Counts the number of sample-frames processed by the destination.
size_t current_sample_frame_; size_t current_sample_frame_;
LocalAudioInputProvider local_audio_input_provider_;
}; };
class AudioDestinationNode : public AudioNode { class AudioDestinationNode : public AudioNode {
......
...@@ -314,10 +314,6 @@ bool OfflineAudioDestinationHandler::RenderIfNotSuspended( ...@@ -314,10 +314,6 @@ bool OfflineAudioDestinationHandler::RenderIfNotSuspended(
return true; return true;
} }
// Prepare the local audio input provider for this render quantum.
if (source_bus)
local_audio_input_provider_.Set(source_bus);
DCHECK_GE(NumberOfInputs(), 1u); DCHECK_GE(NumberOfInputs(), 1u);
if (NumberOfInputs() < 1) { if (NumberOfInputs() < 1) {
destination_bus->Zero(); destination_bus->Zero();
......
...@@ -183,7 +183,7 @@ void AudioDestination::RequestRender(size_t frames_requested, ...@@ -183,7 +183,7 @@ void AudioDestination::RequestRender(size_t frames_requested,
output_position.position = 0.0; output_position.position = 0.0;
// Process WebAudio graph and push the rendered output to FIFO. // Process WebAudio graph and push the rendered output to FIFO.
callback_.Render(nullptr, render_bus_.get(), callback_.Render(render_bus_.get(),
AudioUtilities::kRenderQuantumFrames, output_position); AudioUtilities::kRenderQuantumFrames, output_position);
fifo_->Push(render_bus_.get()); fifo_->Push(render_bus_.get());
} }
......
...@@ -46,11 +46,9 @@ struct AudioIOPosition { ...@@ -46,11 +46,9 @@ struct AudioIOPosition {
// Abstract base-class for isochronous audio I/O client. // Abstract base-class for isochronous audio I/O client.
class AudioIOCallback { class AudioIOCallback {
public: public:
// render() is called periodically to get the next render quantum of audio // Called periodically to get the next render quantum of audio into
// into destinationBus. Optional audio input is given in sourceBus (if it's // |destination_bus|.
// not 0). virtual void Render(AudioBus* destination_bus,
virtual void Render(AudioBus* source_bus,
AudioBus* destination_bus,
size_t frames_to_process, size_t frames_to_process,
const AudioIOPosition& output_position) = 0; const AudioIOPosition& output_position) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment