#include "services/video_capture/virtual_device_enabled_device_factory.h"
#include <utility>
#include "base/functional/bind.h"
#include "media/capture/video/video_capture_device_info.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/video_capture/device_factory.h"
#include "services/video_capture/gpu_memory_buffer_virtual_device_mojo_adapter.h"
#include "services/video_capture/shared_memory_virtual_device_mojo_adapter.h"
#include "services/video_capture/texture_virtual_device_mojo_adapter.h"
namespace video_capture {
class VirtualDeviceEnabledDeviceFactory::VirtualDeviceEntry { … };
VirtualDeviceEnabledDeviceFactory::VirtualDeviceEnabledDeviceFactory(
std::unique_ptr<DeviceFactory> device_factory)
: … { … }
VirtualDeviceEnabledDeviceFactory::~VirtualDeviceEnabledDeviceFactory() =
default;
void VirtualDeviceEnabledDeviceFactory::GetDeviceInfos(
GetDeviceInfosCallback callback) { … }
void VirtualDeviceEnabledDeviceFactory::CreateDevice(
const std::string& device_id,
CreateDeviceCallback callback) { … }
void VirtualDeviceEnabledDeviceFactory::StopDevice(
const std::string device_id) { … }
void VirtualDeviceEnabledDeviceFactory::AddSharedMemoryVirtualDevice(
const media::VideoCaptureDeviceInfo& device_info,
mojo::PendingRemote<mojom::Producer> producer_pending_remote,
mojo::PendingReceiver<mojom::SharedMemoryVirtualDevice>
virtual_device_receiver) { … }
void VirtualDeviceEnabledDeviceFactory::AddTextureVirtualDevice(
const media::VideoCaptureDeviceInfo& device_info,
mojo::PendingReceiver<mojom::TextureVirtualDevice>
virtual_device_receiver) { … }
void VirtualDeviceEnabledDeviceFactory::AddGpuMemoryBufferVirtualDevice(
const media::VideoCaptureDeviceInfo& device_info,
mojo::PendingReceiver<mojom::GpuMemoryBufferVirtualDevice>
virtual_device_receiver) { … }
void VirtualDeviceEnabledDeviceFactory::RegisterVirtualDevicesChangedObserver(
mojo::PendingRemote<mojom::DevicesChangedObserver> observer_pending_remote,
bool raise_event_if_virtual_devices_already_present) { … }
void VirtualDeviceEnabledDeviceFactory::OnGetDeviceInfos(
GetDeviceInfosCallback callback,
const std::vector<media::VideoCaptureDeviceInfo>& device_infos) { … }
void VirtualDeviceEnabledDeviceFactory::
OnVirtualDeviceProducerConnectionErrorOrClose(
const std::string& device_id) { … }
void VirtualDeviceEnabledDeviceFactory::
OnVirtualDeviceConsumerConnectionErrorOrClose(
const std::string& device_id) { … }
void VirtualDeviceEnabledDeviceFactory::EmitDevicesChangedEvent() { … }
void VirtualDeviceEnabledDeviceFactory::OnDevicesChangedObserverDisconnected(
mojom::DevicesChangedObserver* observer) { … }
#if BUILDFLAG(IS_WIN)
void VirtualDeviceEnabledDeviceFactory::OnGpuInfoUpdate(
const CHROME_LUID& luid) {
device_factory_->OnGpuInfoUpdate(luid);
}
#endif
}