#include "third_party/blink/renderer/modules/webaudio/audio_handler.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.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/base_audio_context.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/instance_counters.h"
#if DEBUG_AUDIONODE_REFERENCES
#include <stdio.h>
#endif
namespace blink {
AudioHandler::AudioHandler(NodeType node_type,
AudioNode& node,
float sample_rate)
: … { … }
AudioHandler::~AudioHandler() { … }
void AudioHandler::Initialize() { … }
void AudioHandler::Uninitialize() { … }
void AudioHandler::Dispose() { … }
AudioNode* AudioHandler::GetNode() const { … }
BaseAudioContext* AudioHandler::Context() const { … }
String AudioHandler::NodeTypeName() const { … }
void AudioHandler::SetNodeType(NodeType type) { … }
void AudioHandler::AddInput() { … }
void AudioHandler::AddOutput(unsigned number_of_channels) { … }
AudioNodeInput& AudioHandler::Input(unsigned i) { … }
AudioNodeOutput& AudioHandler::Output(unsigned i) { … }
const AudioNodeOutput& AudioHandler::Output(unsigned i) const { … }
unsigned AudioHandler::ChannelCount() { … }
void AudioHandler::SetInternalChannelCountMode(ChannelCountMode mode) { … }
void AudioHandler::SetInternalChannelInterpretation(
AudioBus::ChannelInterpretation interpretation) { … }
void AudioHandler::SetChannelCount(unsigned channel_count,
ExceptionState& exception_state) { … }
String AudioHandler::GetChannelCountMode() { … }
void AudioHandler::SetChannelCountMode(const String& mode,
ExceptionState& exception_state) { … }
String AudioHandler::ChannelInterpretation() { … }
void AudioHandler::SetChannelInterpretation(const String& interpretation,
ExceptionState& exception_state) { … }
void AudioHandler::UpdateChannelsForInputs() { … }
void AudioHandler::ProcessIfNecessary(uint32_t frames_to_process) { … }
void AudioHandler::CheckNumberOfChannelsForInput(AudioNodeInput* input) { … }
bool AudioHandler::PropagatesSilence() const { … }
void AudioHandler::PullInputs(uint32_t frames_to_process) { … }
bool AudioHandler::InputsAreSilent() { … }
void AudioHandler::SilenceOutputs() { … }
void AudioHandler::UnsilenceOutputs() { … }
void AudioHandler::EnableOutputsIfNecessary() { … }
void AudioHandler::DisableOutputsIfNecessary() { … }
void AudioHandler::DisableOutputs() { … }
void AudioHandler::MakeConnection() { … }
void AudioHandler::BreakConnectionWithLock() { … }
#if DEBUG_AUDIONODE_REFERENCES
bool AudioHandler::is_node_count_initialized_ = false;
int AudioHandler::node_count_[kNodeTypeEnd];
void AudioHandler::PrintNodeCounts() {
fprintf(stderr, "\n\n");
fprintf(stderr, "===========================\n");
fprintf(stderr, "AudioNode: reference counts\n");
fprintf(stderr, "===========================\n");
for (unsigned i = 0; i < kNodeTypeEnd; ++i)
fprintf(stderr, "%2d: %d\n", i, node_count_[i]);
fprintf(stderr, "===========================\n\n\n");
}
#endif
#if DEBUG_AUDIONODE_REFERENCES > 1
void AudioHandler::TailProcessingDebug(const char* note, bool flag) {
fprintf(stderr, "[%16p]: %16p: %2d: %s %d @%.15g flag=%d", Context(), this,
GetNodeType(), note, connection_ref_count_, Context()->currentTime(),
flag);
if (Context()->IsAudioThread()) {
fprintf(stderr, ", tail=%.15g + %.15g, last=%.15g\n", TailTime(),
LatencyTime(), last_non_silent_time_);
}
fprintf(stderr, "\n");
}
void AudioHandler::AddTailProcessingDebug() {
TailProcessingDebug("addTail", false);
}
void AudioHandler::RemoveTailProcessingDebug(bool disable_outputs) {
TailProcessingDebug("remTail", disable_outputs);
}
#endif
void AudioHandler::UpdateChannelCountMode() { … }
void AudioHandler::UpdateChannelInterpretation() { … }
unsigned AudioHandler::NumberOfOutputChannels() const { … }
void AudioHandler::SendLogMessage(const String& message) { … }
}