Establish connections between Browser, Video Capture, and Video Effects
End-to-end connection between Video Effects Manager (Browser process), Video Effects Processor (Video Effects Service process), and Video Capture Device Client (Video Capture Service process) should now be established. Major changes / approach: - Introduce the `media::VideoEffectsContext` struct, declared in video_capture_device_client.h. This allows us to iterate on the specific types that are needed by `VideoCaptureDeviceClient` but without incurring churn. Similar approach could be taken in `VideoCaptureDeviceLauncher::LaunchDeviceAsync()` - VideoEffectsManager is replaced with VideoEffectsProcessor in the codepath from VideoCaptureManager to ContentBrowserClient. Change-Id: I12d5fd855df5ea69670bc33c0165f719ca474f23 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5384525 Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Reviewed-by: Mark Foltz <mfoltz@chromium.org> Reviewed-by: Markus Handell <handellm@google.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Piotr Bialecki <bialpio@chromium.org> Cr-Commit-Position: refs/heads/main@{#1282631}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
68e6e90671
commit
3cab5f9513
ash/capture_mode
components/mirroring/browser
content
browser
renderer_host
media
fake_video_capture_device_launcher.ccfake_video_capture_device_launcher.hin_process_video_capture_device_launcher.ccin_process_video_capture_device_launcher.hmock_video_capture_provider.hservice_video_capture_device_launcher.ccservice_video_capture_device_launcher.hvideo_capture_controller.ccvideo_capture_controller.hvideo_capture_controller_unittest.ccvideo_capture_manager.ccvideo_capture_manager.hvideo_capture_manager_unittest.ccvideo_capture_provider_switcher.cc
public
media/capture
BUILD.gn
video
services
video_capture
BUILD.gnDEPSdevice.hdevice_media_to_mojo_adapter.ccdevice_media_to_mojo_adapter.h
lacros
public
shared_memory_virtual_device_mojo_adapter.ccshared_memory_virtual_device_mojo_adapter.htexture_virtual_device_mojo_adapter.cctexture_virtual_device_mojo_adapter.hvideo_source_impl.ccvideo_source_impl.hvideo_effects
@ -416,8 +416,8 @@ void FakeCameraDevice::CreatePushSubscription(
|
||||
requested_settings);
|
||||
}
|
||||
|
||||
void FakeCameraDevice::RegisterVideoEffectsManager(
|
||||
mojo::PendingRemote<::media::mojom::VideoEffectsManager> remote) {}
|
||||
void FakeCameraDevice::RegisterVideoEffectsProcessor(
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor> remote) {}
|
||||
|
||||
void FakeCameraDevice::OnFinishedConsumingBuffer(int32_t buffer_id) {
|
||||
auto iter = buffer_pool_.find(buffer_id);
|
||||
|
@ -64,8 +64,9 @@ class ASH_EXPORT FakeCameraDevice
|
||||
subscription,
|
||||
CreatePushSubscriptionCallback callback) override;
|
||||
|
||||
void RegisterVideoEffectsManager(
|
||||
mojo::PendingRemote<::media::mojom::VideoEffectsManager> remote) override;
|
||||
void RegisterVideoEffectsProcessor(
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor> remote)
|
||||
override;
|
||||
|
||||
// video_capture::mojom::VideoFrameAccessHandler:
|
||||
void OnFinishedConsumingBuffer(int32_t buffer_id) override;
|
||||
|
@ -1,4 +1,4 @@
|
||||
include_rules = [
|
||||
"+content/public/browser",
|
||||
"+services/video_capture/public/mojom",
|
||||
"+services/video_effects/public/mojom",
|
||||
]
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "content/public/browser/web_contents_media_capture_id.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom.h"
|
||||
|
||||
using media::VideoFrameConsumerFeedbackObserver;
|
||||
|
||||
@ -100,7 +101,7 @@ void SingleClientVideoCaptureHost::Start(
|
||||
std::unique_ptr<DeviceLauncherCallbacks>) {},
|
||||
std::move(device_launcher),
|
||||
std::move(device_launcher_callbacks)),
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>{});
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>{});
|
||||
}
|
||||
|
||||
void SingleClientVideoCaptureHost::Stop(
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -75,15 +76,16 @@ class FakeDeviceLauncher final : public content::VideoCaptureDeviceLauncher {
|
||||
~FakeDeviceLauncher() override = default;
|
||||
|
||||
// content::VideoCaptureDeviceLauncher implementation.
|
||||
void LaunchDeviceAsync(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const VideoCaptureParams& params,
|
||||
base::WeakPtr<VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override {
|
||||
void LaunchDeviceAsync(
|
||||
const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const VideoCaptureParams& params,
|
||||
base::WeakPtr<VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) override {
|
||||
if (!params.IsValid()) {
|
||||
callbacks->OnDeviceLaunchFailed(
|
||||
media::VideoCaptureError::
|
||||
|
@ -89,8 +89,8 @@ void FakeVideoCaptureDeviceLauncher::LaunchDeviceAsync(
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) {
|
||||
auto device = system_->CreateDevice(device_id).ReleaseDevice();
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
scoped_refptr<media::VideoCaptureBufferPool> buffer_pool(
|
||||
@ -114,8 +114,7 @@ void FakeVideoCaptureDeviceLauncher::LaunchDeviceAsync(
|
||||
auto device_client = std::make_unique<media::VideoCaptureDeviceClient>(
|
||||
std::make_unique<media::VideoFrameReceiverOnTaskRunner>(
|
||||
receiver, base::SingleThreadTaskRunner::GetCurrentDefault()),
|
||||
std::move(buffer_pool),
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>{});
|
||||
std::move(buffer_pool), media::VideoEffectsContext({}));
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
device->AllocateAndStart(params, std::move(device_client));
|
||||
auto launched_device =
|
||||
|
@ -8,24 +8,26 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "content/public/browser/video_capture_device_launcher.h"
|
||||
#include "media/capture/video/video_capture_system.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
|
||||
namespace content {
|
||||
|
||||
class FakeVideoCaptureDeviceLauncher
|
||||
: public content::VideoCaptureDeviceLauncher {
|
||||
public:
|
||||
FakeVideoCaptureDeviceLauncher(media::VideoCaptureSystem* system);
|
||||
explicit FakeVideoCaptureDeviceLauncher(media::VideoCaptureSystem* system);
|
||||
~FakeVideoCaptureDeviceLauncher() override;
|
||||
|
||||
void LaunchDeviceAsync(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
void LaunchDeviceAsync(
|
||||
const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) override;
|
||||
void AbortLaunch() override;
|
||||
|
||||
private:
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "content/public/browser/desktop_media_id.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "media/capture/video/fake_video_capture_device.h"
|
||||
#include "media/capture/video/fake_video_capture_device_factory.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool_impl.h"
|
||||
@ -34,6 +33,7 @@
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "media/capture/video/video_frame_receiver.h"
|
||||
#include "media/capture/video/video_frame_receiver_on_task_runner.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_SCREEN_CAPTURE)
|
||||
@ -231,8 +231,8 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync(
|
||||
base::OnceClosure /* connection_lost_cb */,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
DCHECK(state_ == State::READY_TO_LAUNCH);
|
||||
|
||||
@ -408,7 +408,7 @@ InProcessVideoCaptureDeviceLauncher::CreateDeviceClient(
|
||||
#else
|
||||
return std::make_unique<media::VideoCaptureDeviceClient>(
|
||||
std::move(receiver), std::move(buffer_pool),
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>{});
|
||||
media::VideoEffectsContext({}));
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "media/capture/video/video_capture_device.h"
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "media/capture/video/video_capture_device_descriptor.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
|
||||
namespace media {
|
||||
@ -36,15 +37,16 @@ class InProcessVideoCaptureDeviceLauncher : public VideoCaptureDeviceLauncher {
|
||||
scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
|
||||
~InProcessVideoCaptureDeviceLauncher() override;
|
||||
|
||||
void LaunchDeviceAsync(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
void LaunchDeviceAsync(
|
||||
const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) override;
|
||||
|
||||
void AbortLaunch() override;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "content/browser/renderer_host/media/video_capture_provider.h"
|
||||
#include "content/public/browser/video_capture_device_launcher.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
|
||||
namespace content {
|
||||
@ -31,32 +32,20 @@ class MockVideoCaptureDeviceLauncher : public VideoCaptureDeviceLauncher {
|
||||
MockVideoCaptureDeviceLauncher();
|
||||
~MockVideoCaptureDeviceLauncher() override;
|
||||
|
||||
MOCK_METHOD8(DoLaunchDeviceAsync,
|
||||
void(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver>* receiver,
|
||||
base::OnceClosure* connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure* done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager));
|
||||
MOCK_METHOD(void,
|
||||
LaunchDeviceAsync,
|
||||
(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD0(AbortLaunch, void());
|
||||
|
||||
void LaunchDeviceAsync(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override {
|
||||
DoLaunchDeviceAsync(device_id, stream_type, params, &receiver,
|
||||
&connection_lost_cb, callbacks, &done_cb,
|
||||
std::move(video_effects_manager));
|
||||
}
|
||||
MOCK_METHOD(void, AbortLaunch, ());
|
||||
};
|
||||
|
||||
class MockLaunchedVideoCaptureDevice : public LaunchedVideoCaptureDevice {
|
||||
|
@ -13,13 +13,13 @@
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "media/capture/capture_switches.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "media/capture/video/video_capture_device.h"
|
||||
#include "media/capture/video/video_frame_receiver_on_task_runner.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||
#include "services/video_capture/public/cpp/receiver_media_to_mojo_adapter.h"
|
||||
#include "services/video_capture/public/mojom/video_frame_handler.mojom.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "media/base/media_switches.h"
|
||||
@ -87,8 +87,8 @@ void ServiceVideoCaptureDeviceLauncher::LaunchDeviceAsync(
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
DCHECK(state_ == State::READY_TO_LAUNCH);
|
||||
|
||||
@ -127,8 +127,9 @@ void ServiceVideoCaptureDeviceLauncher::LaunchDeviceAsync(
|
||||
mojo::Remote<video_capture::mojom::VideoSource> source;
|
||||
service_connection_->source_provider()->GetVideoSource(
|
||||
device_id, source.BindNewPipeAndPassReceiver());
|
||||
if (video_effects_manager) {
|
||||
source->RegisterVideoEffectsManager(std::move(video_effects_manager));
|
||||
|
||||
if (video_effects_processor) {
|
||||
source->RegisterVideoEffectsProcessor(std::move(video_effects_processor));
|
||||
}
|
||||
|
||||
auto receiver_adapter =
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "content/public/browser/video_capture_device_launcher.h"
|
||||
#include "media/base/scoped_async_trace.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_service.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
|
||||
namespace content {
|
||||
@ -30,15 +31,16 @@ class CONTENT_EXPORT ServiceVideoCaptureDeviceLauncher
|
||||
~ServiceVideoCaptureDeviceLauncher() override;
|
||||
|
||||
// VideoCaptureDeviceLauncher implementation.
|
||||
void LaunchDeviceAsync(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
void LaunchDeviceAsync(
|
||||
const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) override;
|
||||
void AbortLaunch() override;
|
||||
|
||||
private:
|
||||
|
@ -27,11 +27,11 @@
|
||||
#include "media/base/video_frame.h"
|
||||
#include "media/base/video_types.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool.h"
|
||||
#include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "media/capture/video/video_capture_metrics.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
#include "content/browser/compositor/image_transport_factory.h"
|
||||
@ -654,8 +654,8 @@ void VideoCaptureController::CreateAndStartDeviceAsync(
|
||||
const media::VideoCaptureParams& params,
|
||||
VideoCaptureDeviceLaunchObserver* observer,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"),
|
||||
"VideoCaptureController::CreateAndStartDeviceAsync");
|
||||
@ -670,7 +670,7 @@ void VideoCaptureController::CreateAndStartDeviceAsync(
|
||||
device_id_, stream_type_, params, GetWeakPtrForIOThread(),
|
||||
base::BindOnce(&VideoCaptureController::OnDeviceConnectionLost,
|
||||
GetWeakPtrForIOThread()),
|
||||
this, std::move(done_cb), std::move(video_effects_manager));
|
||||
this, std::move(done_cb), std::move(video_effects_processor));
|
||||
}
|
||||
|
||||
void VideoCaptureController::ReleaseDeviceAsync(base::OnceClosure done_cb) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "media/capture/video/video_frame_receiver.h"
|
||||
#include "media/capture/video_capture_types.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/media/video_capture.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
|
||||
@ -136,8 +137,8 @@ class CONTENT_EXPORT VideoCaptureController
|
||||
const media::VideoCaptureParams& params,
|
||||
VideoCaptureDeviceLaunchObserver* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager);
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor);
|
||||
void ReleaseDeviceAsync(base::OnceClosure done_cb);
|
||||
bool IsDeviceAlive() const;
|
||||
void GetPhotoState(
|
||||
|
@ -199,7 +199,7 @@ class VideoCaptureControllerTest
|
||||
device_client_ = std::make_unique<media::VideoCaptureDeviceClient>(
|
||||
std::make_unique<media::VideoFrameReceiverOnTaskRunner>(
|
||||
controller_->GetWeakPtrForIOThread(), GetIOThreadTaskRunner({})),
|
||||
buffer_pool_, mojo::PendingRemote<media::mojom::VideoEffectsManager>{});
|
||||
buffer_pool_, media::VideoEffectsContext({}));
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@
|
||||
#include "media/base/media_switches.h"
|
||||
#include "media/base/video_facing.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "media/capture/video/video_capture_device.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
|
||||
namespace {
|
||||
@ -64,34 +64,35 @@ class VideoCaptureManager::CaptureDeviceStartRequest {
|
||||
VideoCaptureController* controller,
|
||||
const media::VideoCaptureSessionId& session_id,
|
||||
const media::VideoCaptureParams& params,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager);
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor);
|
||||
VideoCaptureController* controller() const { return controller_; }
|
||||
const base::UnguessableToken& session_id() const { return session_id_; }
|
||||
media::VideoCaptureParams params() const { return params_; }
|
||||
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>&&
|
||||
TakeVideoEffectsManager() {
|
||||
return std::move(video_effects_manager_);
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>&&
|
||||
TakeVideoEffectsProcessor() {
|
||||
return std::move(video_effects_processor_);
|
||||
}
|
||||
|
||||
private:
|
||||
const raw_ptr<VideoCaptureController> controller_;
|
||||
const base::UnguessableToken session_id_;
|
||||
const media::VideoCaptureParams params_;
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager> video_effects_manager_;
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor_;
|
||||
};
|
||||
|
||||
VideoCaptureManager::CaptureDeviceStartRequest::CaptureDeviceStartRequest(
|
||||
VideoCaptureController* controller,
|
||||
const media::VideoCaptureSessionId& session_id,
|
||||
const media::VideoCaptureParams& params,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager)
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor)
|
||||
: controller_(controller),
|
||||
session_id_(session_id),
|
||||
params_(params),
|
||||
video_effects_manager_(std::move(video_effects_manager)) {}
|
||||
video_effects_processor_(std::move(video_effects_processor)) {}
|
||||
|
||||
VideoCaptureManager::VideoCaptureManager(
|
||||
std::unique_ptr<VideoCaptureProvider> video_capture_provider,
|
||||
@ -259,12 +260,12 @@ void VideoCaptureManager::QueueStartDevice(
|
||||
const media::VideoCaptureSessionId& session_id,
|
||||
VideoCaptureController* controller,
|
||||
const media::VideoCaptureParams& params,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
DCHECK(lock_time_.is_null());
|
||||
device_start_request_queue_.push_back(CaptureDeviceStartRequest(
|
||||
controller, session_id, params, std::move(video_effects_manager)));
|
||||
controller, session_id, params, std::move(video_effects_processor)));
|
||||
if (device_start_request_queue_.size() == 1)
|
||||
ProcessDeviceStartRequestQueue();
|
||||
}
|
||||
@ -350,7 +351,7 @@ void VideoCaptureManager::ProcessDeviceStartRequestQueue() {
|
||||
scoped_refptr<VideoCaptureController>) {},
|
||||
scoped_refptr<VideoCaptureManager>(this),
|
||||
GetControllerSharedRef(controller)),
|
||||
request->TakeVideoEffectsManager());
|
||||
request->TakeVideoEffectsProcessor());
|
||||
}
|
||||
|
||||
void VideoCaptureManager::OnDeviceLaunched(VideoCaptureController* controller) {
|
||||
@ -449,20 +450,20 @@ void VideoCaptureManager::ConnectClient(
|
||||
<< "VideoCaptureManager queueing device start for device_id = "
|
||||
<< controller->device_id();
|
||||
EmitLogMessage(string_stream.str(), 1);
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager;
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor;
|
||||
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_FUCHSIA)
|
||||
if (base::FeatureList::IsEnabled(media::kCameraMicEffects)) {
|
||||
auto* content_client = GetContentClient();
|
||||
if (browser_context && content_client && content_client->browser()) {
|
||||
content_client->browser()->BindVideoEffectsManager(
|
||||
content_client->browser()->BindVideoEffectsProcessor(
|
||||
controller->device_id(), browser_context,
|
||||
video_effects_manager.InitWithNewPipeAndPassReceiver());
|
||||
video_effects_processor.InitWithNewPipeAndPassReceiver());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
QueueStartDevice(session_id, controller, params,
|
||||
std::move(video_effects_manager));
|
||||
std::move(video_effects_processor));
|
||||
}
|
||||
|
||||
// Run the callback first, as AddClient() may trigger OnFrameInfo().
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "media/capture/video/video_capture_device_info.h"
|
||||
#include "media/capture/video_capture_types.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
@ -123,9 +124,9 @@ class CONTENT_EXPORT VideoCaptureManager
|
||||
// StopCaptureForClient().
|
||||
//
|
||||
// `browser_context` is used to access the `MediaEffectsService` and pass a
|
||||
// `VideoEffectsManager` remote for this device to the
|
||||
// `VideoEffectsProcessor` remote for this device to the
|
||||
// `VideoCaptureDeviceClient`. If the `browser_context` is nullptr then the
|
||||
// device won't get an effects manager.
|
||||
// device won't get an effects processor.
|
||||
void ConnectClient(const media::VideoCaptureSessionId& session_id,
|
||||
const media::VideoCaptureParams& capture_params,
|
||||
VideoCaptureControllerID client_id,
|
||||
@ -304,14 +305,14 @@ class CONTENT_EXPORT VideoCaptureManager
|
||||
// To avoid multiple unnecessary start/stop commands to the OS, each start
|
||||
// request is queued in |device_start_request_queue_|.
|
||||
// QueueStartDevice creates a new entry in |device_start_request_queue_| and
|
||||
// posts a
|
||||
// request to start the device on the device thread unless there is
|
||||
// posts a request to start the device on the device thread unless there is
|
||||
// another request pending start.
|
||||
void QueueStartDevice(const media::VideoCaptureSessionId& session_id,
|
||||
VideoCaptureController* controller,
|
||||
const media::VideoCaptureParams& params,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager);
|
||||
void QueueStartDevice(
|
||||
const media::VideoCaptureSessionId& session_id,
|
||||
VideoCaptureController* controller,
|
||||
const media::VideoCaptureParams& params,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor);
|
||||
void DoStopDevice(VideoCaptureController* controller);
|
||||
void ProcessDeviceStartRequestQueue();
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "media/base/media_switches.h"
|
||||
#include "media/capture/video/fake_video_capture_device_factory.h"
|
||||
#include "media/capture/video/video_capture_system_impl.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
@ -240,6 +241,15 @@ class MockBrowserClient : public content::ContentBrowserClient {
|
||||
mojo::PendingReceiver<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(
|
||||
void,
|
||||
BindVideoEffectsProcessor,
|
||||
(const std::string& device_id,
|
||||
content::BrowserContext* browser_context,
|
||||
mojo::PendingReceiver<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor),
|
||||
(override));
|
||||
};
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@ -432,13 +442,13 @@ TEST_F(VideoCaptureManagerTest, CreateAndClose) {
|
||||
}
|
||||
|
||||
#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA)
|
||||
// Try to start and stop a device with an effects manager
|
||||
TEST_F(VideoCaptureManagerTest, CreateWithVideoEffectsManager) {
|
||||
// Try to start and stop a device with an effects processor
|
||||
TEST_F(VideoCaptureManagerTest, CreateWithVideoEffectsProcessor) {
|
||||
base::test::ScopedFeatureList feature_list;
|
||||
feature_list.InitAndEnableFeature(media::kCameraMicEffects);
|
||||
mojo::PendingReceiver<media::mojom::VideoEffectsManager> receiver;
|
||||
EXPECT_CALL(browser_client_, BindVideoEffectsManager(devices_.front().id,
|
||||
&browser_context_, _))
|
||||
EXPECT_CALL(browser_client_, BindVideoEffectsProcessor(devices_.front().id,
|
||||
&browser_context_, _))
|
||||
.Times(1);
|
||||
|
||||
base::UnguessableToken video_session_id = vcm_->Open(devices_.front());
|
||||
|
@ -3,12 +3,12 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "content/browser/renderer_host/media/video_capture_provider_switcher.h"
|
||||
#include "content/public/browser/video_capture_device_launcher.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "content/public/browser/video_capture_device_launcher.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
|
||||
namespace content {
|
||||
|
||||
@ -24,15 +24,16 @@ class VideoCaptureDeviceLauncherSwitcher : public VideoCaptureDeviceLauncher {
|
||||
|
||||
~VideoCaptureDeviceLauncherSwitcher() override {}
|
||||
|
||||
void LaunchDeviceAsync(const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override {
|
||||
void LaunchDeviceAsync(
|
||||
const std::string& device_id,
|
||||
blink::mojom::MediaStreamType stream_type,
|
||||
const media::VideoCaptureParams& params,
|
||||
base::WeakPtr<media::VideoFrameReceiver> receiver,
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) override {
|
||||
if (stream_type == blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE) {
|
||||
// Use of Unretained() is safe, because |media_device_launcher_| is owned
|
||||
// by |this|.
|
||||
@ -42,7 +43,7 @@ class VideoCaptureDeviceLauncherSwitcher : public VideoCaptureDeviceLauncher {
|
||||
return media_device_launcher_->LaunchDeviceAsync(
|
||||
device_id, stream_type, params, std::move(receiver),
|
||||
std::move(connection_lost_cb), callbacks, std::move(done_cb),
|
||||
std::move(video_effects_manager));
|
||||
std::move(video_effects_processor));
|
||||
}
|
||||
// Use of Unretained() is safe, because |other_types_launcher_| is owned by
|
||||
// |this|.
|
||||
@ -52,7 +53,7 @@ class VideoCaptureDeviceLauncherSwitcher : public VideoCaptureDeviceLauncher {
|
||||
return other_types_launcher_->LaunchDeviceAsync(
|
||||
device_id, stream_type, params, std::move(receiver),
|
||||
std::move(connection_lost_cb), callbacks, std::move(done_cb),
|
||||
std::move(video_effects_manager));
|
||||
std::move(video_effects_processor));
|
||||
}
|
||||
|
||||
void AbortLaunch() override {
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include "base/token.h"
|
||||
#include "content/common/content_export.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom-forward.h"
|
||||
#include "media/capture/video/video_capture_device.h"
|
||||
#include "media/capture/video/video_capture_device_info.h"
|
||||
#include "media/capture/video/video_frame_receiver.h"
|
||||
#include "media/capture/video_capture_types.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
@ -50,9 +50,10 @@ class CONTENT_EXPORT VideoCaptureDeviceLauncher {
|
||||
// The passed-in `done_cb` must guarantee that the context relevant
|
||||
// during the asynchronous processing stays alive.
|
||||
//
|
||||
// The passed-in `video_effects_manager` remote is passed on to
|
||||
// `VideoCaptureDeviceClient`, allowing it to get information about what
|
||||
// effects (if any) should be applied to the video stream. The remote won't
|
||||
// The passed-in `video_effects_processor` remote is passed on to
|
||||
// `VideoCaptureDeviceClient`, allowing it to request post-processing of
|
||||
// video frames according to the effects configuration set on the
|
||||
// VideoEffectsProcessor by the Browser process. The remote won't
|
||||
// be bound to a receiver if the `VideoCaptureHost` couldn't get a valid
|
||||
// `content::BrowserContext`.
|
||||
virtual void LaunchDeviceAsync(
|
||||
@ -63,8 +64,8 @@ class CONTENT_EXPORT VideoCaptureDeviceLauncher {
|
||||
base::OnceClosure connection_lost_cb,
|
||||
Callbacks* callbacks,
|
||||
base::OnceClosure done_cb,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) = 0;
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor) = 0;
|
||||
|
||||
virtual void AbortLaunch() = 0;
|
||||
};
|
||||
|
@ -455,6 +455,7 @@ test("capture_unittests") {
|
||||
"//media/capture/mojom:image_capture_types",
|
||||
"//mojo/core/embedder",
|
||||
"//services/video_capture/public/mojom",
|
||||
"//services/video_effects/test:test_support",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//third_party/libyuv:libyuv",
|
||||
|
@ -3,9 +3,14 @@ include_rules = [
|
||||
"+chromeos/dbus",
|
||||
"+components/device_event_log",
|
||||
"+mojo/public/cpp",
|
||||
# This dependency is safe because it's a leaf in the video_capture_service,
|
||||
# but //media shouldn't depend on anything else from services/video_capture.
|
||||
# TODO(b/303071098) : consider moving VideoEffectsManger to //media/mojo.
|
||||
"+services/video_capture/public/mojom",
|
||||
# This dependency is safe because it's a leaf in the video_effects_service,
|
||||
# but //media shouldn't depend on anything else from services/video_effects.
|
||||
"+services/video_effects/public/mojom",
|
||||
"+third_party/libyuv",
|
||||
]
|
||||
|
||||
specific_include_rules = {
|
||||
"video_capture_device_client_unittest\.cc": [
|
||||
"+services/video_effects/test",
|
||||
]
|
||||
}
|
||||
|
@ -20,11 +20,14 @@
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "media/base/video_frame.h"
|
||||
#include "media/base/video_types.h"
|
||||
#include "media/capture/mojom/video_capture_buffer.mojom-forward.h"
|
||||
#include "media/capture/video/scoped_buffer_pool_reservation.h"
|
||||
#include "media/capture/video/video_capture_buffer_handle.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool.h"
|
||||
#include "media/capture/video/video_frame_receiver.h"
|
||||
#include "media/capture/video_capture_types.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom.h"
|
||||
#include "third_party/libyuv/include/libyuv.h"
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
@ -231,6 +234,21 @@ class BufferPoolBufferHandleProvider
|
||||
const int buffer_id_;
|
||||
};
|
||||
|
||||
VideoEffectsContext::VideoEffectsContext(
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor> remote)
|
||||
: video_effects_processor_(std::move(remote)) {}
|
||||
|
||||
VideoEffectsContext::VideoEffectsContext(VideoEffectsContext&& other) = default;
|
||||
VideoEffectsContext& VideoEffectsContext::operator=(
|
||||
VideoEffectsContext&& other) = default;
|
||||
|
||||
VideoEffectsContext::~VideoEffectsContext() = default;
|
||||
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>&&
|
||||
VideoEffectsContext::TakeVideoEffectsProcessor() {
|
||||
return std::move(video_effects_processor_);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
VideoCaptureDeviceClient::VideoCaptureDeviceClient(
|
||||
std::unique_ptr<VideoFrameReceiver> receiver,
|
||||
@ -249,13 +267,14 @@ VideoCaptureDeviceClient::VideoCaptureDeviceClient(
|
||||
VideoCaptureDeviceClient::VideoCaptureDeviceClient(
|
||||
std::unique_ptr<VideoFrameReceiver> receiver,
|
||||
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager)
|
||||
VideoEffectsContext video_effects_context)
|
||||
: receiver_(std::move(receiver)),
|
||||
buffer_pool_(std::move(buffer_pool)),
|
||||
last_captured_pixel_format_(PIXEL_FORMAT_UNKNOWN),
|
||||
mojo_task_runner_(base::SequencedTaskRunner::GetCurrentDefault()),
|
||||
effects_manager_(std::move(video_effects_manager), mojo_task_runner_) {}
|
||||
effects_processor_(
|
||||
std::move(video_effects_context.TakeVideoEffectsProcessor()),
|
||||
mojo_task_runner_) {}
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {
|
||||
@ -263,7 +282,7 @@ VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {
|
||||
// Make sure that the remote is destroyed from the same sequence that it was
|
||||
// created on.
|
||||
mojo_task_runner_->PostTask(
|
||||
FROM_HERE, base::DoNothingWithBoundArgs(std::move(effects_manager_)));
|
||||
FROM_HERE, base::DoNothingWithBoundArgs(std::move(effects_processor_)));
|
||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
for (int buffer_id : buffer_ids_known_by_receiver_) {
|
||||
receiver_->OnBufferRetired(buffer_id);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "media/capture/video/video_capture_device.h"
|
||||
#include "media/capture/video/video_frame_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom.h"
|
||||
|
||||
namespace media {
|
||||
class VideoCaptureBufferPool;
|
||||
@ -34,6 +35,28 @@ using VideoCaptureJpegDecoderFactoryCB =
|
||||
CAPTURE_EXPORT BASE_DECLARE_FEATURE(kFallbackToSharedMemoryIfNotNv12OnMac);
|
||||
#endif
|
||||
|
||||
// Structure used to inject dependencies required for the
|
||||
// `VideoCaptureDeviceClient` to apply video effects.
|
||||
class CAPTURE_EXPORT VideoEffectsContext {
|
||||
public:
|
||||
explicit VideoEffectsContext(
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor> remote);
|
||||
~VideoEffectsContext();
|
||||
|
||||
VideoEffectsContext(const VideoEffectsContext& other) = delete;
|
||||
VideoEffectsContext& operator=(VideoEffectsContext& other) = delete;
|
||||
|
||||
VideoEffectsContext(VideoEffectsContext&& other);
|
||||
VideoEffectsContext& operator=(VideoEffectsContext&& other);
|
||||
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>&&
|
||||
TakeVideoEffectsProcessor();
|
||||
|
||||
private:
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
video_effects_processor_;
|
||||
};
|
||||
|
||||
// Implementation of VideoCaptureDevice::Client that uses a buffer pool
|
||||
// to provide buffers and converts incoming data to the I420 format for
|
||||
// consumption by a given VideoFrameReceiver. If
|
||||
@ -57,11 +80,9 @@ class CAPTURE_EXPORT VideoCaptureDeviceClient
|
||||
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
|
||||
VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback);
|
||||
#else
|
||||
VideoCaptureDeviceClient(
|
||||
std::unique_ptr<VideoFrameReceiver> receiver,
|
||||
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager);
|
||||
VideoCaptureDeviceClient(std::unique_ptr<VideoFrameReceiver> receiver,
|
||||
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
|
||||
VideoEffectsContext video_effects_context);
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
VideoCaptureDeviceClient(const VideoCaptureDeviceClient&) = delete;
|
||||
@ -166,7 +187,7 @@ class CAPTURE_EXPORT VideoCaptureDeviceClient
|
||||
|
||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
scoped_refptr<base::SequencedTaskRunner> mojo_task_runner_;
|
||||
mojo::Remote<media::mojom::VideoEffectsManager> effects_manager_;
|
||||
mojo::Remote<video_effects::mojom::VideoEffectsProcessor> effects_processor_;
|
||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
// Thread collision warner to ensure that producer-facing API is not called
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "media/base/video_frame.h"
|
||||
#include "media/base/video_types.h"
|
||||
#include "media/capture/mojom/video_capture_buffer.mojom.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "media/capture/video/mock_gpu_memory_buffer_manager.h"
|
||||
#include "media/capture/video/mock_video_frame_receiver.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool_impl.h"
|
||||
@ -27,6 +28,8 @@
|
||||
#include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
|
||||
#include "media/capture/video/video_frame_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom.h"
|
||||
#include "services/video_effects/test/fake_video_effects_processor.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -141,7 +144,11 @@ class VideoCaptureDeviceClientTest : public ::testing::Test {
|
||||
base::test::TaskEnvironment task_environment_;
|
||||
std::unique_ptr<unittest_internal::MockGpuMemoryBufferManager>
|
||||
gpu_memory_buffer_manager_;
|
||||
// Will be nullopt until `Init()` has been called:
|
||||
std::optional<video_effects::FakeVideoEffectsProcessor>
|
||||
fake_video_effects_processor_;
|
||||
FakeVideoEffectsManagerImpl fake_video_effects_manager_;
|
||||
|
||||
mojo::Receiver<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager_receiver_{&fake_video_effects_manager_};
|
||||
|
||||
@ -160,9 +167,21 @@ class VideoCaptureDeviceClientTest : public ::testing::Test {
|
||||
std::move(controller), buffer_pool,
|
||||
base::BindRepeating(&ReturnNullPtrAsJpecDecoder));
|
||||
#else
|
||||
|
||||
mojo::PendingReceiver<video_effects::mojom::VideoEffectsProcessor>
|
||||
processor_receiver;
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
processor_remote(processor_receiver.InitWithNewPipeAndPassRemote());
|
||||
|
||||
mojo::PendingRemote<mojom::VideoEffectsManager> manager_remote =
|
||||
video_effects_manager_receiver_.BindNewPipeAndPassRemote();
|
||||
|
||||
fake_video_effects_processor_.emplace(std::move(processor_receiver),
|
||||
std::move(manager_remote));
|
||||
|
||||
device_client_ = std::make_unique<VideoCaptureDeviceClient>(
|
||||
std::move(controller), buffer_pool,
|
||||
video_effects_manager_receiver_.BindNewPipeAndPassRemote());
|
||||
media::VideoEffectsContext(std::move(processor_remote)));
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
}
|
||||
};
|
||||
|
@ -49,6 +49,8 @@ source_set("lib") {
|
||||
"//services/video_capture/public/cpp",
|
||||
"//services/video_capture/public/mojom",
|
||||
"//services/video_capture/public/mojom:constants",
|
||||
"//services/video_effects:buildflags",
|
||||
"//services/video_effects/public/mojom:mojom",
|
||||
"//services/viz/public/cpp/gpu",
|
||||
]
|
||||
|
||||
|
@ -7,5 +7,6 @@ include_rules = [
|
||||
"+media/mojo",
|
||||
"+media/capture",
|
||||
"+ui/gfx",
|
||||
"+services/video_effects/public/mojom/video_effects_processor.mojom-forward.h",
|
||||
"+services/viz/public/cpp/gpu",
|
||||
]
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef SERVICES_VIDEO_CAPTURE_DEVICE_H_
|
||||
#define SERVICES_VIDEO_CAPTURE_DEVICE_H_
|
||||
|
||||
#include "media/capture/mojom/video_effects_manager.mojom-forward.h"
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "services/video_capture/public/mojom/device.mojom.h"
|
||||
|
||||
namespace media {
|
||||
@ -19,8 +19,7 @@ class Device : public mojom::Device {
|
||||
virtual void StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {}
|
||||
media::VideoEffectsContext context) {}
|
||||
virtual void StopInProcess() {}
|
||||
};
|
||||
|
||||
|
@ -96,14 +96,14 @@ void DeviceMediaToMojoAdapter::Start(
|
||||
"DeviceMediaToMojoAdapter::Start");
|
||||
StartInternal(std::move(requested_settings),
|
||||
std::move(video_frame_handler_pending_remote),
|
||||
/*frame_handler=*/nullptr, /*start_in_process=*/false, {});
|
||||
/*frame_handler=*/nullptr, /*start_in_process=*/false,
|
||||
media::VideoEffectsContext({}));
|
||||
}
|
||||
|
||||
void DeviceMediaToMojoAdapter::StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
media::VideoEffectsContext context) {
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"),
|
||||
"DeviceMediaToMojoAdapter::StartInProcess");
|
||||
@ -111,7 +111,7 @@ void DeviceMediaToMojoAdapter::StartInProcess(
|
||||
StartInternal(std::move(requested_settings),
|
||||
/*handler_pending_remote=*/std::nullopt,
|
||||
std::move(frame_handler), /*start_in_process=*/true,
|
||||
std::move(video_effects_manager));
|
||||
std::move(context));
|
||||
}
|
||||
|
||||
void DeviceMediaToMojoAdapter::StartInternal(
|
||||
@ -120,8 +120,7 @@ void DeviceMediaToMojoAdapter::StartInternal(
|
||||
handler_pending_remote,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
bool start_in_process,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
media::VideoEffectsContext context) {
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"),
|
||||
"DeviceMediaToMojoAdapter::StartInternal");
|
||||
@ -188,7 +187,7 @@ void DeviceMediaToMojoAdapter::StartInternal(
|
||||
&media::VideoFrameReceiver::OnLog, video_frame_receiver))));
|
||||
#else // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
auto device_client = std::make_unique<media::VideoCaptureDeviceClient>(
|
||||
std::move(media_receiver), buffer_pool, std::move(video_effects_manager));
|
||||
std::move(media_receiver), buffer_pool, std::move(context));
|
||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
device_->AllocateAndStart(requested_settings, std::move(device_client));
|
||||
|
@ -54,8 +54,7 @@ class DeviceMediaToMojoAdapter : public Device {
|
||||
void StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
media::VideoEffectsContext context) override;
|
||||
void StopInProcess() override;
|
||||
void MaybeSuspend() override;
|
||||
void Resume() override;
|
||||
@ -80,8 +79,7 @@ class DeviceMediaToMojoAdapter : public Device {
|
||||
handler_pending_remote,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
bool start_in_process,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager);
|
||||
media::VideoEffectsContext context);
|
||||
|
||||
const std::unique_ptr<media::VideoCaptureDevice> device_;
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "media/capture/mojom/image_capture.mojom.h"
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "services/video_capture/lacros/video_frame_handler_proxy_lacros.h"
|
||||
|
||||
namespace video_capture {
|
||||
@ -45,8 +46,7 @@ void DeviceProxyLacros::Start(
|
||||
void DeviceProxyLacros::StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
media::VideoEffectsContext context) {
|
||||
mojo::PendingRemote<crosapi::mojom::VideoFrameHandler> proxy_handler_remote;
|
||||
handler_ = std::make_unique<VideoFrameHandlerProxyLacros>(
|
||||
proxy_handler_remote.InitWithNewPipeAndPassReceiver(),
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "chromeos/crosapi/mojom/video_capture.mojom.h"
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
@ -37,8 +38,7 @@ class DeviceProxyLacros : public video_capture::Device {
|
||||
void StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
media::VideoEffectsContext context) override;
|
||||
void MaybeSuspend() override;
|
||||
void Resume() override;
|
||||
void GetPhotoState(GetPhotoStateCallback callback) override;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "services/video_capture/public/mojom/video_frame_handler.mojom.h"
|
||||
#include "services/video_capture/public/mojom/video_source.mojom.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
|
||||
namespace video_capture {
|
||||
@ -35,8 +36,9 @@ class MockVideoSource : public video_capture::mojom::VideoSource {
|
||||
video_capture::mojom::PushVideoStreamSubscription> subscription,
|
||||
CreatePushSubscriptionCallback& callback));
|
||||
|
||||
MOCK_METHOD1(RegisterVideoEffectsManager,
|
||||
void(mojo::PendingRemote<media::mojom::VideoEffectsManager>));
|
||||
MOCK_METHOD1(
|
||||
RegisterVideoEffectsProcessor,
|
||||
void(mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>));
|
||||
};
|
||||
|
||||
} // namespace video_capture
|
||||
|
@ -23,6 +23,7 @@ mojom("mojom") {
|
||||
"//media/capture/mojom:image_capture",
|
||||
"//media/capture/mojom:video_capture",
|
||||
"//media/mojo/mojom",
|
||||
"//services/video_effects/public/mojom:mojom",
|
||||
"//ui/gfx/geometry/mojom",
|
||||
]
|
||||
|
||||
|
@ -6,7 +6,7 @@ module video_capture.mojom;
|
||||
|
||||
import "media/capture/mojom/image_capture.mojom";
|
||||
import "media/capture/mojom/video_capture_types.mojom";
|
||||
import "media/capture/mojom/video_effects_manager.mojom";
|
||||
import "services/video_effects/public/mojom/video_effects_processor.mojom";
|
||||
import "services/video_capture/public/mojom/video_frame_handler.mojom";
|
||||
|
||||
enum CreatePushSubscriptionSuccessCode {
|
||||
@ -97,8 +97,8 @@ interface VideoSource {
|
||||
=> (CreatePushSubscriptionResultCode result_code,
|
||||
media.mojom.VideoCaptureParams settings_source_was_opened_with);
|
||||
|
||||
// Registers a `remote` that the video capture service can use to get
|
||||
// effect configuration for the video stream.
|
||||
RegisterVideoEffectsManager(
|
||||
pending_remote<media.mojom.VideoEffectsManager> remote);
|
||||
// Registers a `remote` that the Video Capture Service can use to process
|
||||
// video frames. The processing will happen in Video Effects Service.
|
||||
RegisterVideoEffectsProcessor(
|
||||
pending_remote<video_effects.mojom.VideoEffectsProcessor> remote);
|
||||
};
|
||||
|
@ -172,8 +172,7 @@ void SharedMemoryVirtualDeviceMojoAdapter::Start(
|
||||
void SharedMemoryVirtualDeviceMojoAdapter::StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
media::VideoEffectsContext context) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
video_frame_handler_in_process_ = std::move(frame_handler);
|
||||
video_frame_handler_in_process_->OnStarted();
|
||||
|
@ -47,8 +47,7 @@ class SharedMemoryVirtualDeviceMojoAdapter
|
||||
void StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
media::VideoEffectsContext context) override;
|
||||
void MaybeSuspend() override;
|
||||
void Resume() override;
|
||||
void GetPhotoState(GetPhotoStateCallback callback) override;
|
||||
|
@ -138,8 +138,7 @@ void TextureVirtualDeviceMojoAdapter::Start(
|
||||
void TextureVirtualDeviceMojoAdapter::StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) {
|
||||
media::VideoEffectsContext context) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
video_frame_handler_in_process_ = std::move(frame_handler);
|
||||
video_frame_handler_in_process_->OnStarted();
|
||||
|
@ -51,8 +51,7 @@ class TextureVirtualDeviceMojoAdapter : public mojom::TextureVirtualDevice,
|
||||
void StartInProcess(
|
||||
const media::VideoCaptureParams& requested_settings,
|
||||
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
video_effects_manager) override;
|
||||
media::VideoEffectsContext context) override;
|
||||
void MaybeSuspend() override;
|
||||
void Resume() override;
|
||||
void GetPhotoState(GetPhotoStateCallback callback) override;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "media/capture/video/video_capture_device_client.h"
|
||||
#include "services/video_capture/push_video_stream_subscription_impl.h"
|
||||
|
||||
namespace video_capture {
|
||||
@ -85,9 +86,9 @@ void VideoSourceImpl::CreatePushSubscription(
|
||||
}
|
||||
}
|
||||
|
||||
void VideoSourceImpl::RegisterVideoEffectsManager(
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager> remote) {
|
||||
pending_video_effects_manager_ = std::move(remote);
|
||||
void VideoSourceImpl::RegisterVideoEffectsProcessor(
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor> remote) {
|
||||
pending_video_effects_processor_ = std::move(remote);
|
||||
}
|
||||
|
||||
void VideoSourceImpl::OnClientDisconnected() {
|
||||
@ -143,9 +144,10 @@ void VideoSourceImpl::OnCreateDeviceResponse(
|
||||
scoped_trace->AddStep("StartDevice");
|
||||
|
||||
// Device was created successfully.
|
||||
info.device->StartInProcess(device_start_settings_,
|
||||
broadcaster_.GetWeakPtr(),
|
||||
std::move(pending_video_effects_manager_));
|
||||
info.device->StartInProcess(
|
||||
device_start_settings_, broadcaster_.GetWeakPtr(),
|
||||
media::VideoEffectsContext(
|
||||
std::move(pending_video_effects_processor_)));
|
||||
UmaHistogramTimes("Media.VideoCapture.StartSourceSuccessLatency",
|
||||
base::TimeTicks::Now() - device_startup_start_time_);
|
||||
device_status_ = DeviceStatus::kStarted;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "services/video_capture/public/mojom/video_frame_handler.mojom.h"
|
||||
#include "services/video_capture/public/mojom/video_source.mojom.h"
|
||||
#include "services/video_capture/public/mojom/video_source_provider.mojom.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
|
||||
|
||||
namespace video_capture {
|
||||
|
||||
@ -48,8 +49,9 @@ class VideoSourceImpl : public mojom::VideoSource {
|
||||
mojo::PendingReceiver<mojom::PushVideoStreamSubscription> subscription,
|
||||
CreatePushSubscriptionCallback callback) override;
|
||||
|
||||
void RegisterVideoEffectsManager(
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager> remote) override;
|
||||
void RegisterVideoEffectsProcessor(
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor> remote)
|
||||
override;
|
||||
|
||||
private:
|
||||
enum class DeviceStatus {
|
||||
@ -88,8 +90,12 @@ class VideoSourceImpl : public mojom::VideoSource {
|
||||
raw_ptr<Device, AcrossTasksDanglingUntriaged> device_{nullptr};
|
||||
media::VideoCaptureParams device_start_settings_;
|
||||
bool restart_device_once_when_stop_complete_ = false;
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager>
|
||||
pending_video_effects_manager_;
|
||||
|
||||
// Video effects processor that will be used to start the capture on the
|
||||
// `device_`.
|
||||
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
|
||||
pending_video_effects_processor_;
|
||||
|
||||
base::TimeTicks device_startup_start_time_;
|
||||
|
||||
SEQUENCE_CHECKER(sequence_checker_);
|
||||
|
@ -3,6 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "services/video_effects/test/fake_video_effects_processor.h"
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom-shared.h"
|
||||
#include "services/video_effects/public/mojom/video_effects_processor.mojom.h"
|
||||
|
||||
@ -11,7 +13,14 @@ namespace video_effects {
|
||||
FakeVideoEffectsProcessor::FakeVideoEffectsProcessor(
|
||||
mojo::PendingReceiver<mojom::VideoEffectsProcessor> processor,
|
||||
mojo::PendingRemote<media::mojom::VideoEffectsManager> manager)
|
||||
: receiver_(this, std::move(processor)), manager_(std::move(manager)) {}
|
||||
: receiver_(this, std::move(processor)), manager_(std::move(manager)) {
|
||||
receiver_.set_disconnect_handler(
|
||||
base::BindOnce(&FakeVideoEffectsProcessor::OnMojoConnectionLost,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
manager_.set_disconnect_handler(
|
||||
base::BindOnce(&FakeVideoEffectsProcessor::OnMojoConnectionLost,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
FakeVideoEffectsProcessor::~FakeVideoEffectsProcessor() = default;
|
||||
|
||||
@ -30,4 +39,9 @@ FakeVideoEffectsProcessor::GetVideoEffectsManager() {
|
||||
return manager_;
|
||||
}
|
||||
|
||||
void FakeVideoEffectsProcessor::OnMojoConnectionLost() {
|
||||
receiver_.reset();
|
||||
manager_.reset();
|
||||
}
|
||||
|
||||
} // namespace video_effects
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef SERVICES_VIDEO_EFFECTS_TEST_FAKE_VIDEO_EFFECTS_PROCESSOR_H_
|
||||
#define SERVICES_VIDEO_EFFECTS_TEST_FAKE_VIDEO_EFFECTS_PROCESSOR_H_
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "media/capture/mojom/video_effects_manager.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
@ -33,8 +34,13 @@ class FakeVideoEffectsProcessor : public mojom::VideoEffectsProcessor {
|
||||
mojo::Remote<media::mojom::VideoEffectsManager>& GetVideoEffectsManager();
|
||||
|
||||
private:
|
||||
void OnMojoConnectionLost();
|
||||
|
||||
mojo::Receiver<mojom::VideoEffectsProcessor> receiver_;
|
||||
mojo::Remote<media::mojom::VideoEffectsManager> manager_;
|
||||
|
||||
// Must be last:
|
||||
base::WeakPtrFactory<FakeVideoEffectsProcessor> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace video_effects
|
||||
|
Reference in New Issue
Block a user