#include "content/browser/media/forwarding_audio_stream_factory.h"
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/no_destructor.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/audio_service.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "media/base/audio_parameters.h"
#include "media/base/user_input_monitor.h"
#include "ui/gfx/geometry/size.h"
namespace content {
namespace {
ForwardingAudioStreamFactory::AudioStreamFactoryBinder&
GetAudioStreamFactoryBinderOverride() { … }
void BindStreamFactoryFromUIThread(
mojo::PendingReceiver<media::mojom::AudioStreamFactory> receiver) { … }
}
ForwardingAudioStreamFactory::Core::Core(
base::WeakPtr<ForwardingAudioStreamFactory> owner,
media::UserInputMonitorBase* user_input_monitor,
std::unique_ptr<AudioStreamBrokerFactory> broker_factory)
: … { … }
ForwardingAudioStreamFactory::Core::~Core() { … }
base::WeakPtr<ForwardingAudioStreamFactory::Core>
ForwardingAudioStreamFactory::Core::AsWeakPtr() { … }
void ForwardingAudioStreamFactory::Core::CreateInputStream(
int render_process_id,
int render_frame_id,
const std::string& device_id,
const media::AudioParameters& params,
uint32_t shared_memory_count,
bool enable_agc,
media::mojom::AudioProcessingConfigPtr processing_config,
mojo::PendingRemote<blink::mojom::RendererAudioInputStreamFactoryClient>
renderer_factory_client) { … }
void ForwardingAudioStreamFactory::Core::AssociateInputAndOutputForAec(
const base::UnguessableToken& input_stream_id,
const std::string& raw_output_device_id) { … }
void ForwardingAudioStreamFactory::Core::CreateOutputStream(
int render_process_id,
int render_frame_id,
const std::string& device_id,
const media::AudioParameters& params,
mojo::PendingRemote<media::mojom::AudioOutputStreamProviderClient> client) { … }
void ForwardingAudioStreamFactory::Core::CreateLoopbackStream(
int render_process_id,
int render_frame_id,
AudioStreamBroker::LoopbackSource* loopback_source,
const media::AudioParameters& params,
uint32_t shared_memory_count,
bool mute_source,
mojo::PendingRemote<blink::mojom::RendererAudioInputStreamFactoryClient>
renderer_factory_client) { … }
void ForwardingAudioStreamFactory::Core::SetMuted(bool muted) { … }
void ForwardingAudioStreamFactory::Core::AddLoopbackSink(
AudioStreamBroker::LoopbackSink* sink) { … }
void ForwardingAudioStreamFactory::Core::RemoveLoopbackSink(
AudioStreamBroker::LoopbackSink* sink) { … }
const base::UnguessableToken& ForwardingAudioStreamFactory::Core::GetGroupID() { … }
ForwardingAudioStreamFactory* ForwardingAudioStreamFactory::ForFrame(
RenderFrameHost* frame) { … }
ForwardingAudioStreamFactory::Core* ForwardingAudioStreamFactory::CoreForFrame(
RenderFrameHost* frame) { … }
ForwardingAudioStreamFactory::ForwardingAudioStreamFactory(
WebContents* web_contents,
media::UserInputMonitorBase* user_input_monitor,
std::unique_ptr<AudioStreamBrokerFactory> broker_factory)
: … { … }
ForwardingAudioStreamFactory::~ForwardingAudioStreamFactory() { … }
void ForwardingAudioStreamFactory::LoopbackStreamStarted() { … }
void ForwardingAudioStreamFactory::LoopbackStreamStopped() { … }
void ForwardingAudioStreamFactory::SetMuted(bool muted) { … }
bool ForwardingAudioStreamFactory::IsMuted() const { … }
void ForwardingAudioStreamFactory::RenderFrameDeleted(
RenderFrameHost* render_frame_host) { … }
void ForwardingAudioStreamFactory::OverrideAudioStreamFactoryBinderForTesting(
AudioStreamFactoryBinder binder) { … }
void ForwardingAudioStreamFactory::Core::CleanupStreamsBelongingTo(
int render_process_id,
int render_frame_id) { … }
void ForwardingAudioStreamFactory::Core::RemoveInput(
AudioStreamBroker* broker) { … }
void ForwardingAudioStreamFactory::Core::RemoveOutput(
AudioStreamBroker* broker) { … }
media::mojom::AudioStreamFactory*
ForwardingAudioStreamFactory::Core::GetFactory() { … }
void ForwardingAudioStreamFactory::Core::ResetRemoteFactoryPtrIfIdle() { … }
void ForwardingAudioStreamFactory::Core::ResetRemoteFactoryPtr() { … }
}