chromium/services/audio/output_device_mixer_impl.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// Do not change: used for UMA reporting, matches
// AudioOutputDeviceMixerStreamStatus from enums.xml.
enum class TrackError {};

const char* TrackErrorToString(TrackError error) {}

}  // namespace

// Audio data flow though the mixer:
//
// * Independent (ummixed) audio stream playback:
//    MixTrack::|audio_source_callback_|
//    -> MixTrack::|rendering_stream_|.
//
// * Mixed playback:
//    MixTrack::|audio_source_callback_|
//    -> MixTrack::|graph_input_|
//    --> OutputDeviceMixerImpl::|mixing_graph_|
//    ---> OutputDeviceMixerImpl::|mixing_graph_rendering_stream_|

// Helper class which stores all the data associated with a specific audio
// output managed by the mixer. To the clients such an audio output is
// represented as MixableOutputStream (below).
class OutputDeviceMixerImpl::MixTrack final
    : public media::AudioOutputStream::AudioSourceCallback {};

// A proxy which represents MixTrack as media::AudioOutputStream.
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) {}

// Processes errors coming from |mixing_graph_| during mixed playback.
void OutputDeviceMixerImpl::OnMixingGraphError(ErrorType error) {}

bool OutputDeviceMixerImpl::HasListeners() const {}

void OutputDeviceMixerImpl::EnsureMixingGraphOutputStreamOpen() {}

// Expects |mixing_graph_output_stream_| to be already open; if not - this is
// interpreted as a failure.
void OutputDeviceMixerImpl::StartMixingGraphPlayback() {}

void OutputDeviceMixerImpl::StopMixingGraphPlayback(MixingError error) {}

void OutputDeviceMixerImpl::SwitchToUnmixedPlaybackTimerHelper() {}

// static
const char* OutputDeviceMixerImpl::ErrorToString(MixingError error) {}

}  // namespace audio