#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/speech/audio_encoder.h"
#include <stddef.h>
#include <memory>
#include "base/check_op.h"
#include "base/containers/heap_array.h"
#include "base/strings/string_number_conversions.h"
#include "components/speech/audio_buffer.h"
namespace {
const char kContentTypeFLAC[] = …;
const int kFLACCompressionLevel = …;
FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder* encoder,
const FLAC__byte buffer[],
size_t bytes,
unsigned samples,
unsigned current_frame,
void* client_data) { … }
}
AudioEncoder::AudioEncoder(int sampling_rate, int bits_per_sample)
: … { … }
AudioEncoder::~AudioEncoder() = default;
void AudioEncoder::Encode(const AudioChunk& raw_audio) { … }
void AudioEncoder::Flush() { … }
scoped_refptr<AudioChunk> AudioEncoder::GetEncodedDataAndClear() { … }
std::string AudioEncoder::GetMimeType() { … }
int AudioEncoder::GetBitsPerSample() { … }