#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/audio/pulse/audio_manager_pulse.h"
#include <algorithm>
#include <utility>
#include "base/command_line.h"
#include "base/environment.h"
#include "base/logging.h"
#include "base/nix/xdg_util.h"
#include "build/chromeos_buildflags.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/pulse/pulse_input.h"
#include "media/audio/pulse/pulse_loopback_manager.h"
#include "media/audio/pulse/pulse_output.h"
#include "media/audio/pulse/pulse_util.h"
#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
namespace media {
AutoPulseLock;
WaitForOperationCompletion;
constexpr int kMaxOutputStreams = …;
constexpr int kMinimumOutputBufferSize = …;
constexpr int kMaximumOutputBufferSize = …;
constexpr int kDefaultInputBufferSize = …;
constexpr int kDefaultSampleRate = …;
constexpr int kDefaultChannelCount = …;
AudioManagerPulse::AudioManagerPulse(std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory,
pa_threaded_mainloop* pa_mainloop,
pa_context* pa_context)
: … { … }
AudioManagerPulse::~AudioManagerPulse() = default;
void AudioManagerPulse::ShutdownOnAudioThread() { … }
bool AudioManagerPulse::HasAudioOutputDevices() { … }
bool AudioManagerPulse::HasAudioInputDevices() { … }
void AudioManagerPulse::GetAudioDeviceNames(
bool input, media::AudioDeviceNames* device_names) { … }
void AudioManagerPulse::GetAudioInputDeviceNames(
AudioDeviceNames* device_names) { … }
void AudioManagerPulse::GetAudioOutputDeviceNames(
AudioDeviceNames* device_names) { … }
AudioParameters AudioManagerPulse::GetInputStreamParameters(
const std::string& device_id) { … }
const char* AudioManagerPulse::GetName() { … }
AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream(
const AudioParameters& params,
const LogCallback& log_callback) { … }
AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioInputStream* AudioManagerPulse::MakeLinearInputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioInputStream* AudioManagerPulse::MakeLowLatencyInputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
std::string AudioManagerPulse::GetDefaultInputDeviceID() { … }
std::string AudioManagerPulse::GetDefaultOutputDeviceID() { … }
std::string AudioManagerPulse::GetAssociatedOutputDeviceID(
const std::string& input_device_id) { … }
AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters(
const std::string& output_device_id,
const AudioParameters& input_params) { … }
AudioOutputStream* AudioManagerPulse::MakeOutputStream(
const AudioParameters& params,
const std::string& device_id,
LogCallback log_callback) { … }
AudioInputStream* AudioManagerPulse::MakeInputStream(
const AudioParameters& params,
const std::string& device_id,
LogCallback log_callback) { … }
void AudioManagerPulse::UpdateNativeAudioHardwareInfo() { … }
void AudioManagerPulse::InputDevicesInfoCallback(pa_context* context,
const pa_source_info* info,
int eol,
void* user_data) { … }
void AudioManagerPulse::OutputDevicesInfoCallback(pa_context* context,
const pa_sink_info* info,
int eol,
void* user_data) { … }
void AudioManagerPulse::AudioHardwareInfoCallback(pa_context* context,
const pa_server_info* info,
void* user_data) { … }
void AudioManagerPulse::DefaultSourceInfoCallback(pa_context* context,
const pa_source_info* info,
int eol,
void* user_data) { … }
}