#include "components/media_effects/media_effects_service.h"
#include <optional>
#include "base/auto_reset.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/media_effects/media_effects_model_provider.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_client.h"
#include "content/public/browser/service_process_host.h"
#include "media/capture/mojom/video_effects_manager.mojom.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/video_effects/public/mojom/video_effects_processor.mojom.h"
#include "services/video_effects/public/mojom/video_effects_service.mojom.h"
#include "services/viz/public/mojom/gpu.mojom.h"
namespace {
static mojo::Remote<video_effects::mojom::VideoEffectsService>*
g_service_remote = …;
video_effects::mojom::VideoEffectsService* GetVideoEffectsService() { … }
}
base::AutoReset<mojo::Remote<video_effects::mojom::VideoEffectsService>*>
SetVideoEffectsServiceRemoteForTesting(
mojo::Remote<video_effects::mojom::VideoEffectsService>* service_override) { … }
MediaEffectsService::MediaEffectsService(
PrefService* prefs,
std::unique_ptr<MediaEffectsModelProvider> model_provider)
: … { … }
MediaEffectsService::~MediaEffectsService() { … }
void MediaEffectsService::BindVideoEffectsManager(
const std::string& device_id,
mojo::PendingReceiver<media::mojom::VideoEffectsManager>
effects_manager_receiver) { … }
void MediaEffectsService::BindVideoEffectsProcessor(
const std::string& device_id,
mojo::PendingReceiver<video_effects::mojom::VideoEffectsProcessor>
effects_processor_receiver) { … }
void MediaEffectsService::OnBackgroundSegmentationModelUpdated(
const base::FilePath& path) { … }
void MediaEffectsService::OnBackgroundSegmentationModelOpened(
base::File model_file) { … }
VideoEffectsManagerImpl& MediaEffectsService::GetOrCreateVideoEffectsManager(
const std::string& device_id) { … }
void MediaEffectsService::OnLastReceiverDisconnected(
const std::string& device_id) { … }