#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/audio/alsa/audio_manager_alsa.h"
#include <stddef.h>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/free_deleter.h"
#include "base/metrics/histogram.h"
#include "media/audio/alsa/alsa_input.h"
#include "media/audio/alsa/alsa_output.h"
#include "media/audio/alsa/alsa_wrapper.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_output_dispatcher.h"
#if defined(USE_PULSEAUDIO)
#include "media/audio/pulse/audio_manager_pulse.h"
#endif
#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
namespace media {
static const int kMaxOutputStreams = …;
static const int kDefaultSampleRate = …;
static const char* const kInvalidAudioInputDevices[] = …;
AudioManagerAlsa::AudioManagerAlsa(std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory)
: … { … }
AudioManagerAlsa::~AudioManagerAlsa() = default;
bool AudioManagerAlsa::HasAudioOutputDevices() { … }
bool AudioManagerAlsa::HasAudioInputDevices() { … }
void AudioManagerAlsa::GetAudioInputDeviceNames(
AudioDeviceNames* device_names) { … }
void AudioManagerAlsa::GetAudioOutputDeviceNames(
AudioDeviceNames* device_names) { … }
AudioParameters AudioManagerAlsa::GetInputStreamParameters(
const std::string& device_id) { … }
const char* AudioManagerAlsa::GetName() { … }
void AudioManagerAlsa::GetAlsaAudioDevices(StreamType type,
AudioDeviceNames* device_names) { … }
void AudioManagerAlsa::GetAlsaDevicesInfo(AudioManagerAlsa::StreamType type,
void** hints,
AudioDeviceNames* device_names) { … }
bool AudioManagerAlsa::IsAlsaDeviceAvailable(
AudioManagerAlsa::StreamType type,
const char* device_name) { … }
void AudioManagerAlsa::AddAlsaDeviceFromSwitch(const char* switch_name,
AudioDeviceNames* device_names) { … }
const char* AudioManagerAlsa::UnwantedDeviceTypeWhenEnumerating(
AudioManagerAlsa::StreamType wanted_type) { … }
bool AudioManagerAlsa::HasAnyAlsaAudioDevice(
AudioManagerAlsa::StreamType stream) { … }
AudioOutputStream* AudioManagerAlsa::MakeLinearOutputStream(
const AudioParameters& params,
const LogCallback& log_callback) { … }
AudioOutputStream* AudioManagerAlsa::MakeLowLatencyOutputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioInputStream* AudioManagerAlsa::MakeLinearInputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioInputStream* AudioManagerAlsa::MakeLowLatencyInputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioParameters AudioManagerAlsa::GetPreferredOutputStreamParameters(
const std::string& output_device_id,
const AudioParameters& input_params) { … }
AudioOutputStream* AudioManagerAlsa::MakeOutputStream(
const AudioParameters& params) { … }
AudioInputStream* AudioManagerAlsa::MakeInputStream(
const AudioParameters& params, const std::string& device_id) { … }
}