#include "media/base/audio_parameters.h"
#include <sstream>
#include "base/check_op.h"
#include "media/base/audio_bus.h"
#include "media/base/channel_layout.h"
#include "media/base/limits.h"
namespace media {
namespace {
int ComputeChannelCount(ChannelLayout channel_layout, int channels) { … }
}
static_assert …;
static_assert …;
static_assert …;
const char* FormatToString(AudioParameters::Format format) { … }
base::CheckedNumeric<uint32_t> ComputeAudioInputBufferSizeChecked(
const AudioParameters& parameters,
uint32_t shared_memory_count) { … }
uint32_t ComputeAudioInputBufferSize(const AudioParameters& parameters,
uint32_t shared_memory_count) { … }
uint32_t ComputeAudioInputBufferSize(int channels,
int frames,
uint32_t shared_memory_count) { … }
base::CheckedNumeric<uint32_t> ComputeAudioOutputBufferSizeChecked(
const AudioParameters& parameters) { … }
uint32_t ComputeAudioOutputBufferSize(const AudioParameters& parameters) { … }
uint32_t ComputeAudioOutputBufferSize(int channels, int frames) { … }
ChannelLayoutConfig::ChannelLayoutConfig(const ChannelLayoutConfig& other) =
default;
ChannelLayoutConfig& ChannelLayoutConfig::operator=(
const ChannelLayoutConfig& other) = default;
ChannelLayoutConfig::~ChannelLayoutConfig() = default;
ChannelLayoutConfig::ChannelLayoutConfig()
: … { … }
ChannelLayoutConfig::ChannelLayoutConfig(ChannelLayout channel_layout,
int channels)
: … { … }
ChannelLayoutConfig ChannelLayoutConfig::Mono() { … }
ChannelLayoutConfig ChannelLayoutConfig::Stereo() { … }
ChannelLayoutConfig ChannelLayoutConfig::Guess(int channels) { … }
AudioParameters::AudioParameters()
: … { … }
AudioParameters::AudioParameters(Format format,
ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer)
: … { … }
AudioParameters::AudioParameters(
Format format,
ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer,
const HardwareCapabilities& hardware_capabilities)
: … { … }
AudioParameters::~AudioParameters() = default;
AudioParameters::AudioParameters(const AudioParameters&) = default;
AudioParameters& AudioParameters::operator=(const AudioParameters&) = default;
void AudioParameters::Reset(Format format,
ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer) { … }
bool AudioParameters::IsValid() const { … }
std::string AudioParameters::AsHumanReadableString() const { … }
int AudioParameters::GetBytesPerBuffer(SampleFormat fmt) const { … }
int AudioParameters::GetBytesPerFrame(SampleFormat fmt) const { … }
double AudioParameters::GetMicrosecondsPerFrame() const { … }
base::TimeDelta AudioParameters::GetBufferDuration() const { … }
bool AudioParameters::Equals(const AudioParameters& other) const { … }
bool AudioParameters::IsBitstreamFormat() const { … }
bool AudioParameters::IsFormatSupportedByHardware(Format format) const { … }
void AudioParameters::SetChannelLayoutConfig(ChannelLayout layout,
int channels) { … }
bool AudioParameters::RequireEncapsulation() const { … }
bool AudioParameters::RequireOffload() const { … }
AudioParameters AudioParameters::UnavailableDeviceParams() { … }
}