#include "services/audio/output_device_mixer_impl.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/dcheck_is_on.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_io.h"
namespace audio {
constexpr base::TimeDelta OutputDeviceMixerImpl::kSwitchToUnmixedPlaybackDelay;
constexpr double OutputDeviceMixerImpl::kDefaultVolume;
namespace {
enum class TrackError { … };
const char* TrackErrorToString(TrackError error) { … }
}
class OutputDeviceMixerImpl::MixTrack final
: public media::AudioOutputStream::AudioSourceCallback { … };
class OutputDeviceMixerImpl::MixableOutputStream final
: public media::AudioOutputStream { … };
OutputDeviceMixerImpl::OutputDeviceMixerImpl(
const std::string& device_id,
const media::AudioParameters& output_params,
MixingGraph::CreateCallback create_mixing_graph_callback,
CreateStreamCallback create_stream_callback)
: … { … }
OutputDeviceMixerImpl::~OutputDeviceMixerImpl() { … }
media::AudioOutputStream* OutputDeviceMixerImpl::MakeMixableStream(
const media::AudioParameters& params,
base::OnceClosure on_device_change_callback) { … }
void OutputDeviceMixerImpl::ProcessDeviceChange() { … }
void OutputDeviceMixerImpl::StartListening(Listener* listener) { … }
void OutputDeviceMixerImpl::StopListening(Listener* listener) { … }
bool OutputDeviceMixerImpl::OpenStream(MixTrack* mix_track) { … }
void OutputDeviceMixerImpl::StartStream(
MixTrack* mix_track,
media::AudioOutputStream::AudioSourceCallback* callback) { … }
void OutputDeviceMixerImpl::StopStream(MixTrack* mix_track) { … }
void OutputDeviceMixerImpl::CloseStream(MixTrack* mix_track) { … }
media::AudioOutputStream* OutputDeviceMixerImpl::CreateAndOpenDeviceStream(
const media::AudioParameters& params) { … }
void OutputDeviceMixerImpl::BroadcastToListeners(
const media::AudioBus& audio_bus,
base::TimeDelta delay) { … }
void OutputDeviceMixerImpl::OnMixingGraphError(ErrorType error) { … }
bool OutputDeviceMixerImpl::HasListeners() const { … }
void OutputDeviceMixerImpl::EnsureMixingGraphOutputStreamOpen() { … }
void OutputDeviceMixerImpl::StartMixingGraphPlayback() { … }
void OutputDeviceMixerImpl::StopMixingGraphPlayback(MixingError error) { … }
void OutputDeviceMixerImpl::SwitchToUnmixedPlaybackTimerHelper() { … }
const char* OutputDeviceMixerImpl::ErrorToString(MixingError error) { … }
}