#include "media/audio/audio_manager_base.h"
#include <memory>
#include <optional>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_input_stream_data_interceptor.h"
#include "media/audio/audio_output_dispatcher_impl.h"
#include "media/audio/audio_output_proxy.h"
#include "media/audio/audio_output_resampler.h"
#include "media/audio/fake_audio_input_stream.h"
#include "media/audio/fake_audio_output_stream.h"
#include "media/base/media_switches.h"
namespace media {
namespace {
const int kStreamCloseDelaySeconds = …;
const int kDefaultMaxOutputStreams = …;
const int kMaxInputStreams = …;
const int kMaxInputChannels = …;
std::unique_ptr<AudioDebugRecorder> GetNullptrAudioDebugRecorder(
const AudioParameters& params) { … }
enum StreamFormat { … };
enum class MakeAudioInputStreamResult { … };
void LogMakeAudioInputStreamResult(MakeAudioInputStreamResult result) { … }
PRINTF_FORMAT(2, 3)
void SendLogMessage(const AudioManagerBase::LogCallback& callback,
const char* format,
...) { … }
}
struct AudioManagerBase::DispatcherParams { … };
AudioManagerBase::AudioManagerBase(std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory)
: … { … }
AudioManagerBase::~AudioManagerBase() { … }
void AudioManagerBase::GetAudioInputDeviceDescriptions(
AudioDeviceDescriptions* device_descriptions) { … }
void AudioManagerBase::GetAudioOutputDeviceDescriptions(
AudioDeviceDescriptions* device_descriptions) { … }
void AudioManagerBase::GetAudioDeviceDescriptions(
AudioDeviceDescriptions* device_descriptions,
void (AudioManagerBase::*get_device_names)(AudioDeviceNames*),
std::string (AudioManagerBase::*get_default_device_id)(),
std::string (AudioManagerBase::*get_communications_device_id)(),
std::string (AudioManagerBase::*get_group_id)(const std::string&)) { … }
AudioOutputStream* AudioManagerBase::MakeAudioOutputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioOutputStream* AudioManagerBase::MakeBitstreamOutputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioInputStream* AudioManagerBase::MakeAudioInputStream(
const AudioParameters& input_params,
const std::string& device_id,
const LogCallback& log_callback) { … }
AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
const AudioParameters& params,
const std::string& device_id) { … }
void AudioManagerBase::GetAudioInputDeviceNames(
AudioDeviceNames* device_names) { … }
void AudioManagerBase::GetAudioOutputDeviceNames(
AudioDeviceNames* device_names) { … }
void AudioManagerBase::ReleaseOutputStream(AudioOutputStream* stream) { … }
void AudioManagerBase::ReleaseInputStream(AudioInputStream* stream) { … }
void AudioManagerBase::ShutdownOnAudioThread() { … }
void AudioManagerBase::AddOutputDeviceChangeListener(
AudioDeviceListener* listener) { … }
void AudioManagerBase::RemoveOutputDeviceChangeListener(
AudioDeviceListener* listener) { … }
void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() { … }
AudioParameters AudioManagerBase::GetOutputStreamParameters(
const std::string& device_id) { … }
AudioParameters AudioManagerBase::GetInputStreamParameters(
const std::string& device_id) { … }
std::string AudioManagerBase::GetAssociatedOutputDeviceID(
const std::string& input_device_id) { … }
std::string AudioManagerBase::GetGroupIDOutput(
const std::string& output_device_id) { … }
std::string AudioManagerBase::GetGroupIDInput(
const std::string& input_device_id) { … }
void AudioManagerBase::CloseAllInputStreams() { … }
std::string AudioManagerBase::GetDefaultInputDeviceID() { … }
std::string AudioManagerBase::GetDefaultOutputDeviceID() { … }
std::string AudioManagerBase::GetCommunicationsInputDeviceID() { … }
std::string AudioManagerBase::GetCommunicationsOutputDeviceID() { … }
int AudioManagerBase::GetUserBufferSize() { … }
std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
AudioLogFactory::AudioComponent component,
int component_id) { … }
void AudioManagerBase::InitializeDebugRecording() { … }
std::unique_ptr<AudioDebugRecordingManager>
AudioManagerBase::CreateAudioDebugRecordingManager() { … }
AudioDebugRecordingManager* AudioManagerBase::GetAudioDebugRecordingManager() { … }
void AudioManagerBase::SetAecDumpRecordingManager(
base::WeakPtr<AecdumpRecordingManager>) { … }
}