// 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. #ifndef SERVICES_AUDIO_OUTPUT_DEVICE_MIXER_IMPL_H_ #define SERVICES_AUDIO_OUTPUT_DEVICE_MIXER_IMPL_H_ #include <memory> #include <set> #include <string> #include "base/check.h" #include "base/containers/unique_ptr_adapters.h" #include "base/dcheck_is_on.h" #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/synchronization/lock.h" #include "base/timer/timer.h" #include "media/audio/audio_io.h" #include "media/base/audio_parameters.h" #include "media/base/reentrancy_checker.h" #include "services/audio/mixing_graph.h" #include "services/audio/output_device_mixer.h" namespace audio { class MixingGraph; // OutputDeviceMixerImpl manages the rendering of all output streams created by // MakeMixableStream(). It has two rendering modes: if there // are not listeners attached, each active output stream is rendered // independently. If the mixer has listeners and at least one of the managed // streams there is playing, all output streams are mixed by // |mixing_graph_| and the result is played by |mixing_graph_output_stream_|. // After mixing started, the mixed playback will stop only when the last // listener is gone; this means the mixed playback will continue even when there // are no managed streams playing. That is done because the listeners do not // like when the reference signal stops and then starts again: it can cause // reference signal delay jumps. TODO(olka): add metrics for how often/how long // we may have listeners forsing such silent mixed playback. class OutputDeviceMixerImpl final : public OutputDeviceMixer { … }; } // namespace audio #endif // SERVICES_AUDIO_OUTPUT_DEVICE_MIXER_IMPL_H_