| Index: content/browser/renderer_host/media/in_process_buildable_video_capture_device.h
|
| diff --git a/content/browser/renderer_host/media/in_process_buildable_video_capture_device.h b/content/browser/renderer_host/media/in_process_buildable_video_capture_device.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d12db4a4ecf6ba70705ff9e22b1a43ba84c45bf4
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/media/in_process_buildable_video_capture_device.h
|
| @@ -0,0 +1,105 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
|
| +#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
|
| +
|
| +#include "content/browser/renderer_host/media/video_capture_controller.h"
|
| +#include "content/browser/renderer_host/media/video_capture_device_entry.h"
|
| +#include "content/public/common/media_stream_request.h"
|
| +#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 "media/capture/video/video_capture_device_factory.h"
|
| +
|
| +namespace content {
|
| +
|
| +// Implementation of BuildableVideoCaptureDevice that creates capture devices
|
| +// in the same process as it is being operated on, which must be the Browser
|
| +// process. The devices are operated on the given |device_task_runner|.
|
| +// Instances of this class must be operated from the Browser process IO thread.
|
| +class InProcessBuildableVideoCaptureDevice
|
| + : public BuildableVideoCaptureDevice {
|
| + public:
|
| + InProcessBuildableVideoCaptureDevice(
|
| + scoped_refptr<base::SingleThreadTaskRunner> device_task_runner,
|
| + media::VideoCaptureDeviceFactory* device_factory);
|
| + ~InProcessBuildableVideoCaptureDevice() override;
|
| +
|
| + // DeviceEntryBuilder implementation:
|
| + void CreateAndStartDeviceAsync(
|
| + VideoCaptureDeviceEntry* entry,
|
| + VideoCaptureController* controller,
|
| + const media::VideoCaptureParams& params,
|
| + BuildableDeviceCallbacks* callbacks,
|
| + std::unique_ptr<Ownership> context_reference) override;
|
| + void ReleaseDeviceAsync(
|
| + VideoCaptureController* controller,
|
| + std::unique_ptr<Ownership> context_reference) override;
|
| + bool HasDevice() const override;
|
| + void GetPhotoCapabilities(
|
| + media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback)
|
| + const override;
|
| + void SetPhotoOptions(
|
| + media::mojom::PhotoSettingsPtr settings,
|
| + media::VideoCaptureDevice::SetPhotoOptionsCallback callback) override;
|
| + void TakePhoto(
|
| + media::VideoCaptureDevice::TakePhotoCallback callback) override;
|
| + void MaybeSuspendDevice() override;
|
| + void ResumeDevice() override;
|
| + void RequestRefreshFrame() override;
|
| +
|
| + void SetDesktopCaptureWindowIdAsync(
|
| + gfx::NativeViewId window_id,
|
| + std::unique_ptr<Ownership> context_reference) override;
|
| +
|
| + private:
|
| + using ReceiveDeviceCallback =
|
| + base::Callback<void(std::unique_ptr<media::VideoCaptureDevice> device)>;
|
| +
|
| + bool IsOnDeviceThread() const;
|
| +
|
| + std::unique_ptr<media::VideoCaptureDeviceClient> CreateDeviceClient(
|
| + int buffer_pool_max_buffer_count,
|
| + base::WeakPtr<media::VideoFrameReceiver> receiver);
|
| +
|
| + void OnDeviceStarted(VideoCaptureDeviceEntry* entry,
|
| + VideoCaptureController* controller,
|
| + BuildableDeviceCallbacks* callbacks,
|
| + std::unique_ptr<Ownership> ownership,
|
| + std::unique_ptr<media::VideoCaptureDevice> device);
|
| +
|
| + void DoStartDeviceCaptureOnDeviceThread(
|
| + const media::VideoCaptureDeviceDescriptor& descriptor,
|
| + const media::VideoCaptureParams& params,
|
| + std::unique_ptr<media::VideoCaptureDeviceClient> client,
|
| + ReceiveDeviceCallback result_callback);
|
| +
|
| + void DoStartTabCaptureOnDeviceThread(
|
| + const std::string& device_id,
|
| + const media::VideoCaptureParams& params,
|
| + std::unique_ptr<media::VideoCaptureDeviceClient> client,
|
| + ReceiveDeviceCallback result_callback);
|
| +
|
| + void DoStartDesktopCaptureOnDeviceThread(
|
| + const std::string& device_id,
|
| + const media::VideoCaptureParams& params,
|
| + std::unique_ptr<media::VideoCaptureDeviceClient> client,
|
| + ReceiveDeviceCallback result_callback);
|
| +
|
| + void SetDesktopCaptureWindowIdOnDeviceThread(
|
| + media::VideoCaptureDevice* device,
|
| + gfx::NativeViewId window_id,
|
| + std::unique_ptr<Ownership> ownership);
|
| +
|
| + void ReleaseDeviceAsyncNonVirtual();
|
| +
|
| + const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
|
| + media::VideoCaptureDeviceFactory* const device_factory_;
|
| + std::unique_ptr<media::VideoCaptureDevice> device_;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
|
|
|