#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/audio/audio_debug_file_writer.h"
#include <stdint.h>
#include <array>
#include <limits>
#include <memory>
#include <utility>
#include "base/containers/span.h"
#include "base/containers/span_writer.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_span.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_bus_pool.h"
#include "media/base/audio_sample_types.h"
namespace media {
namespace {
static const uint16_t kBytesPerSample = …;
static const uint32_t kWavHeaderSize = …;
static const uint32_t kFmtChunkSize = …;
static const uint32_t kChunkHeaderSize = …;
static const uint16_t kWavFormatPcm = …;
static const uint8_t kRiff[] = …;
static const uint8_t kWave[] = …;
static const uint8_t kFmt[] = …;
static const uint8_t kData[] = …;
WavHeaderBuffer;
void WriteWavHeader(WavHeaderBuffer* buf,
uint32_t channels,
uint32_t sample_rate,
uint64_t samples) { … }
}
AudioDebugFileWriter::~AudioDebugFileWriter() { … }
void AudioDebugFileWriter::Write(const AudioBus& data) { … }
AudioDebugFileWriter::Ptr AudioDebugFileWriter::Create(
const AudioParameters& params,
base::File file) { … }
AudioDebugFileWriter::AudioDebugFileWriter(
const AudioParameters& params,
base::File file,
std::unique_ptr<AudioBusPool> audio_bus_pool)
: … { … }
AudioDebugFileWriter::Ptr AudioDebugFileWriter::Create(
const AudioParameters& params,
base::File file,
std::unique_ptr<AudioBusPool> audio_bus_pool) { … }
void AudioDebugFileWriter::DoWrite(std::unique_ptr<AudioBus> data) { … }
void AudioDebugFileWriter::WriteHeader() { … }
}