#include "third_party/blink/public/web/modules/media/audio/audio_device_factory.h"
#include <algorithm>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/task/thread_pool.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/audio/audio_input_device.h"
#include "media/audio/audio_output_device.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/modules/media/audio/audio_input_ipc_factory.h"
#include "third_party/blink/public/web/modules/media/audio/audio_output_ipc_factory.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_input.h"
#include "third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_manager.h"
#include "third_party/blink/renderer/modules/media/audio/audio_renderer_sink_cache.h"
#include "third_party/blink/renderer/platform/wtf/wtf.h"
namespace blink {
namespace {
AudioDeviceFactory* g_factory_override = …;
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS_LACROS)
constexpr base::TimeDelta kMaxAuthorizationTimeout = …;
#else
constexpr base::TimeDelta kMaxAuthorizationTimeout;
#endif
base::TimeDelta GetDefaultAuthTimeout() { … }
scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
const blink::LocalFrameToken& frame_token,
const media::AudioSinkParameters& params,
base::TimeDelta auth_timeout) { … }
bool IsMixable(blink::WebAudioDeviceSourceType source_type) { … }
}
AudioDeviceFactory* AudioDeviceFactory::GetInstance() { … }
AudioDeviceFactory::AudioDeviceFactory(bool override_default) { … }
AudioDeviceFactory::~AudioDeviceFactory() { … }
media::AudioLatency::Type AudioDeviceFactory::GetSourceLatencyType(
blink::WebAudioDeviceSourceType source) { … }
scoped_refptr<media::AudioRendererSink>
AudioDeviceFactory::NewAudioRendererSink(
blink::WebAudioDeviceSourceType source_type,
const blink::LocalFrameToken& frame_token,
const media::AudioSinkParameters& params) { … }
scoped_refptr<media::SwitchableAudioRendererSink>
AudioDeviceFactory::NewMixableSink(blink::WebAudioDeviceSourceType source_type,
const blink::LocalFrameToken& frame_token,
const blink::FrameToken& main_frame_token,
const media::AudioSinkParameters& params) { … }
scoped_refptr<media::AudioCapturerSource>
AudioDeviceFactory::NewAudioCapturerSource(
WebLocalFrame* web_frame,
const media::AudioSourceParameters& params) { … }
media::OutputDeviceInfo AudioDeviceFactory::GetOutputDeviceInfo(
const blink::LocalFrameToken& frame_token,
const std::string& device_id) { … }
}