OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_D
EVICE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_D
EVICE_H_ |
| 7 |
| 8 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 9 #include "content/public/common/media_stream_request.h" |
| 10 #include "media/capture/video/video_capture_device.h" |
| 11 #include "media/capture/video/video_capture_device_client.h" |
| 12 #include "media/capture/video/video_capture_device_descriptor.h" |
| 13 #include "media/capture/video/video_capture_device_factory.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // Implementation of BuildableVideoCaptureDevice that creates capture devices |
| 18 // in the same process as it is being operated on, which must be the Browser |
| 19 // process. The devices are operated on the given |device_task_runner|. |
| 20 // Instances of this class must be operated from the Browser process IO thread. |
| 21 class InProcessBuildableVideoCaptureDevice |
| 22 : public BuildableVideoCaptureDevice { |
| 23 public: |
| 24 InProcessBuildableVideoCaptureDevice( |
| 25 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner, |
| 26 media::VideoCaptureDeviceFactory* device_factory); |
| 27 ~InProcessBuildableVideoCaptureDevice() override; |
| 28 |
| 29 // BuildableVideoCaptureDevice implementation: |
| 30 void CreateAndStartDeviceAsync(VideoCaptureController* controller, |
| 31 const media::VideoCaptureParams& params, |
| 32 Callbacks* callbacks, |
| 33 base::OnceClosure done_cb) override; |
| 34 void ReleaseDeviceAsync(VideoCaptureController* controller, |
| 35 base::OnceClosure done_cb) override; |
| 36 bool IsDeviceAlive() const override; |
| 37 void GetPhotoCapabilities( |
| 38 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback) |
| 39 const override; |
| 40 void SetPhotoOptions( |
| 41 media::mojom::PhotoSettingsPtr settings, |
| 42 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) override; |
| 43 void TakePhoto( |
| 44 media::VideoCaptureDevice::TakePhotoCallback callback) override; |
| 45 void MaybeSuspendDevice() override; |
| 46 void ResumeDevice() override; |
| 47 void RequestRefreshFrame() override; |
| 48 |
| 49 void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id, |
| 50 base::OnceClosure done_cb) override; |
| 51 |
| 52 private: |
| 53 using ReceiveDeviceCallback = |
| 54 base::Callback<void(std::unique_ptr<media::VideoCaptureDevice> device)>; |
| 55 |
| 56 std::unique_ptr<media::VideoCaptureDeviceClient> CreateDeviceClient( |
| 57 int buffer_pool_max_buffer_count, |
| 58 base::WeakPtr<media::VideoFrameReceiver> receiver); |
| 59 |
| 60 void OnDeviceStarted(VideoCaptureController* controller, |
| 61 Callbacks* callbacks, |
| 62 base::OnceClosure done_cb, |
| 63 std::unique_ptr<media::VideoCaptureDevice> device); |
| 64 |
| 65 void DoStartDeviceCaptureOnDeviceThread( |
| 66 const media::VideoCaptureDeviceDescriptor& descriptor, |
| 67 const media::VideoCaptureParams& params, |
| 68 std::unique_ptr<media::VideoCaptureDeviceClient> client, |
| 69 ReceiveDeviceCallback result_callback); |
| 70 |
| 71 void DoStartTabCaptureOnDeviceThread( |
| 72 const std::string& device_id, |
| 73 const media::VideoCaptureParams& params, |
| 74 std::unique_ptr<media::VideoCaptureDeviceClient> client, |
| 75 ReceiveDeviceCallback result_callback); |
| 76 |
| 77 void DoStartDesktopCaptureOnDeviceThread( |
| 78 const std::string& device_id, |
| 79 const media::VideoCaptureParams& params, |
| 80 std::unique_ptr<media::VideoCaptureDeviceClient> client, |
| 81 ReceiveDeviceCallback result_callback); |
| 82 |
| 83 void SetDesktopCaptureWindowIdOnDeviceThread( |
| 84 media::VideoCaptureDevice* device, |
| 85 gfx::NativeViewId window_id, |
| 86 base::OnceClosure done_cb); |
| 87 |
| 88 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
| 89 media::VideoCaptureDeviceFactory* const device_factory_; |
| 90 std::unique_ptr<media::VideoCaptureDevice> device_; |
| 91 }; |
| 92 |
| 93 } // namespace content |
| 94 |
| 95 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTUR
E_DEVICE_H_ |
OLD | NEW |