#include "third_party/blink/renderer/modules/mediarecorder/audio_track_opus_encoder.h"
#include <memory>
#include <optional>
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/time/time.h"
#include "media/base/audio_sample_types.h"
#include "media/base/audio_timestamp_helper.h"
namespace {
enum : int { … };
const int kOpusPreferredFramesPerBuffer = …;
bool DoEncode(OpusEncoder* opus_encoder,
float* data_in,
int num_samples,
std::string* data_out) { … }
}
namespace blink {
AudioTrackOpusEncoder::AudioTrackOpusEncoder(
OnEncodedAudioCB on_encoded_audio_cb,
uint32_t bits_per_second,
bool vbr_enabled)
: … { … }
AudioTrackOpusEncoder::~AudioTrackOpusEncoder() { … }
double AudioTrackOpusEncoder::ProvideInput(
media::AudioBus* audio_bus,
uint32_t frames_delayed,
const media::AudioGlitchInfo& glitch_info) { … }
void AudioTrackOpusEncoder::OnSetFormat(
const media::AudioParameters& input_params) { … }
void AudioTrackOpusEncoder::EncodeAudio(
std::unique_ptr<media::AudioBus> input_bus,
base::TimeTicks capture_time) { … }
void AudioTrackOpusEncoder::DestroyExistingOpusEncoder() { … }
}