#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/webaudio/script_processor_handler.h"
#include <memory>
#include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/modules/webaudio/audio_buffer.h"
#include "third_party/blink/renderer/modules/webaudio/audio_graph_tracer.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_input.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/modules/webaudio/audio_processing_event.h"
#include "third_party/blink/renderer/modules/webaudio/base_audio_context.h"
#include "third_party/blink/renderer/modules/webaudio/realtime_audio_destination_node.h"
#include "third_party/blink/renderer/modules/webaudio/script_processor_node.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace blink {
ScriptProcessorHandler::ScriptProcessorHandler(
AudioNode& node,
float sample_rate,
uint32_t buffer_size,
uint32_t number_of_input_channels,
uint32_t number_of_output_channels,
const HeapVector<Member<AudioBuffer>>& input_buffers,
const HeapVector<Member<AudioBuffer>>& output_buffers)
: … { … }
scoped_refptr<ScriptProcessorHandler> ScriptProcessorHandler::Create(
AudioNode& node,
float sample_rate,
uint32_t buffer_size,
uint32_t number_of_input_channels,
uint32_t number_of_output_channels,
const HeapVector<Member<AudioBuffer>>& input_buffers,
const HeapVector<Member<AudioBuffer>>& output_buffers) { … }
ScriptProcessorHandler::~ScriptProcessorHandler() { … }
void ScriptProcessorHandler::Initialize() { … }
void ScriptProcessorHandler::Process(uint32_t frames_to_process) { … }
void ScriptProcessorHandler::FireProcessEvent(uint32_t double_buffer_index) { … }
void ScriptProcessorHandler::FireProcessEventForOfflineAudioContext(
uint32_t double_buffer_index,
base::WaitableEvent* waitable_event) { … }
bool ScriptProcessorHandler::RequiresTailProcessing() const { … }
double ScriptProcessorHandler::TailTime() const { … }
double ScriptProcessorHandler::LatencyTime() const { … }
void ScriptProcessorHandler::SetChannelCount(uint32_t channel_count,
ExceptionState& exception_state) { … }
void ScriptProcessorHandler::SetChannelCountMode(
const String& mode,
ExceptionState& exception_state) { … }
}