#include "services/audio/snooper_node.h"
#include <algorithm>
#include <cmath>
#include "base/functional/bind.h"
#include "base/numerics/checked_math.h"
#include "base/trace_event/trace_event.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_timestamp_helper.h"
Helper;
namespace audio {
namespace {
constexpr base::TimeDelta kDelayBufferSize = …;
constexpr int kStepBasisHz = …;
constexpr int kResamplerRequestSize = …;
base::TimeDelta GetReferenceTimeSkipThreshold(base::TimeDelta bus_duration) { … }
}
constexpr SnooperNode::FrameTicks SnooperNode::kNullPosition;
constexpr SnooperNode::FrameTicks SnooperNode::kWriteStartPosition;
SnooperNode::SnooperNode(const media::AudioParameters& input_params,
const media::AudioParameters& output_params)
: … { … }
SnooperNode::~SnooperNode() = default;
void SnooperNode::OnData(const media::AudioBus& input_bus,
base::TimeTicks reference_time,
double volume) { … }
std::optional<base::TimeTicks> SnooperNode::SuggestLatestRenderTime(
FrameTicks duration) { … }
void SnooperNode::Render(base::TimeTicks reference_time,
media::AudioBus* output_bus) { … }
void SnooperNode::UpdateCorrectionRate(int correction_fps) { … }
void SnooperNode::ReadFromDelayBuffer(int ignored,
media::AudioBus* resampler_bus) { … }
}