Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: content/browser/renderer_host/media/in_process_video_capture_device_launcher.h

Issue 2803483003: [Mojo Video Capture] Split interface BuildableVideoCaptureDevice (Closed)
Patch Set: Remove fallback mechanism. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_D EVICE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_VIDEO_CAPTURE_DEVICE_LAUN CHER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTURE_D EVICE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_VIDEO_CAPTURE_DEVICE_LAUN CHER_H_
7 7
8 #include "content/browser/renderer_host/media/video_capture_controller.h" 8 #include "content/browser/renderer_host/media/video_capture_controller.h"
9 #include "content/browser/renderer_host/media/video_capture_provider.h" 9 #include "content/browser/renderer_host/media/video_capture_provider.h"
10 #include "content/public/common/media_stream_request.h" 10 #include "content/public/common/media_stream_request.h"
11 #include "media/capture/video/video_capture_device.h" 11 #include "media/capture/video/video_capture_device.h"
12 #include "media/capture/video/video_capture_device_client.h" 12 #include "media/capture/video/video_capture_device_client.h"
13 #include "media/capture/video/video_capture_device_descriptor.h" 13 #include "media/capture/video/video_capture_device_descriptor.h"
14 #include "media/capture/video/video_capture_system.h" 14 #include "media/capture/video/video_capture_system.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // Implementation of BuildableVideoCaptureDevice that creates capture devices 18 // Implementation of BuildableVideoCaptureDevice that creates capture devices
19 // in the same process as it is being operated on, which must be the Browser 19 // in the same process as it is being operated on, which must be the Browser
20 // process. The devices are operated on the given |device_task_runner|. 20 // process. The devices are operated on the given |device_task_runner|.
21 // Instances of this class must be operated from the Browser process IO thread. 21 // Instances of this class must be operated from the Browser process IO thread.
22 class InProcessBuildableVideoCaptureDevice 22 class InProcessVideoCaptureDeviceLauncher : public VideoCaptureDeviceLauncher {
23 : public BuildableVideoCaptureDevice {
24 public: 23 public:
25 InProcessBuildableVideoCaptureDevice( 24 InProcessVideoCaptureDeviceLauncher(
26 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner, 25 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner,
27 media::VideoCaptureSystem* video_capture_system); 26 media::VideoCaptureSystem* video_capture_system);
28 ~InProcessBuildableVideoCaptureDevice() override; 27 ~InProcessVideoCaptureDeviceLauncher() override;
29 28
30 // BuildableVideoCaptureDevice implementation: 29 void LaunchDeviceAsync(const std::string& device_id,
31 void CreateAndStartDeviceAsync(VideoCaptureController* controller, 30 MediaStreamType stream_type,
32 const media::VideoCaptureParams& params, 31 const media::VideoCaptureParams& params,
33 Callbacks* callbacks, 32 base::WeakPtr<media::VideoFrameReceiver> receiver,
34 base::OnceClosure done_cb) override; 33 Callbacks* callbacks,
35 void ReleaseDeviceAsync(VideoCaptureController* controller, 34 base::OnceClosure done_cb) override;
36 base::OnceClosure done_cb) override;
37 bool IsDeviceAlive() const override;
38 void GetPhotoCapabilities(
39 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback)
40 const override;
41 void SetPhotoOptions(
42 media::mojom::PhotoSettingsPtr settings,
43 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) override;
44 void TakePhoto(
45 media::VideoCaptureDevice::TakePhotoCallback callback) override;
46 void MaybeSuspendDevice() override;
47 void ResumeDevice() override;
48 void RequestRefreshFrame() override;
49 35
50 void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id, 36 void AbortLaunch() override;
51 base::OnceClosure done_cb) override;
52 37
53 private: 38 private:
54 using ReceiveDeviceCallback = 39 using ReceiveDeviceCallback =
55 base::Callback<void(std::unique_ptr<media::VideoCaptureDevice> device)>; 40 base::Callback<void(std::unique_ptr<media::VideoCaptureDevice> device)>;
56 41
57 enum class State { 42 enum class State {
58 NO_DEVICE, 43 READY_TO_LAUNCH,
59 DEVICE_START_IN_PROGRESS, 44 DEVICE_START_IN_PROGRESS,
60 DEVICE_START_ABORTING, 45 DEVICE_START_ABORTING
61 DEVICE_STARTED
62 }; 46 };
63 47
64 std::unique_ptr<media::VideoCaptureDeviceClient> CreateDeviceClient( 48 std::unique_ptr<media::VideoCaptureDeviceClient> CreateDeviceClient(
65 int buffer_pool_max_buffer_count, 49 int buffer_pool_max_buffer_count,
66 base::WeakPtr<media::VideoFrameReceiver> receiver); 50 base::WeakPtr<media::VideoFrameReceiver> receiver);
67 51
68 void OnDeviceStarted(VideoCaptureController* controller, 52 void OnDeviceStarted(Callbacks* callbacks,
69 Callbacks* callbacks,
70 base::OnceClosure done_cb, 53 base::OnceClosure done_cb,
71 std::unique_ptr<media::VideoCaptureDevice> device); 54 std::unique_ptr<media::VideoCaptureDevice> device);
72 55
73 void DoStartDeviceCaptureOnDeviceThread( 56 void DoStartDeviceCaptureOnDeviceThread(
74 const std::string& device_id, 57 const std::string& device_id,
75 const media::VideoCaptureParams& params, 58 const media::VideoCaptureParams& params,
76 std::unique_ptr<media::VideoCaptureDeviceClient> client, 59 std::unique_ptr<media::VideoCaptureDeviceClient> client,
77 ReceiveDeviceCallback result_callback); 60 ReceiveDeviceCallback result_callback);
78 61
79 void DoStartTabCaptureOnDeviceThread( 62 void DoStartTabCaptureOnDeviceThread(
80 const std::string& device_id, 63 const std::string& device_id,
81 const media::VideoCaptureParams& params, 64 const media::VideoCaptureParams& params,
82 std::unique_ptr<media::VideoCaptureDeviceClient> client, 65 std::unique_ptr<media::VideoCaptureDeviceClient> client,
83 ReceiveDeviceCallback result_callback); 66 ReceiveDeviceCallback result_callback);
84 67
85 void DoStartDesktopCaptureOnDeviceThread( 68 void DoStartDesktopCaptureOnDeviceThread(
86 const std::string& device_id, 69 const std::string& device_id,
87 const media::VideoCaptureParams& params, 70 const media::VideoCaptureParams& params,
88 std::unique_ptr<media::VideoCaptureDeviceClient> client, 71 std::unique_ptr<media::VideoCaptureDeviceClient> client,
89 ReceiveDeviceCallback result_callback); 72 ReceiveDeviceCallback result_callback);
90 73
91 void SetDesktopCaptureWindowIdOnDeviceThread(
92 media::VideoCaptureDevice* device,
93 gfx::NativeViewId window_id,
94 base::OnceClosure done_cb);
95
96 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; 74 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
97 media::VideoCaptureSystem* const video_capture_system_; 75 media::VideoCaptureSystem* const video_capture_system_;
98 std::unique_ptr<media::VideoCaptureDevice> device_; 76 State state_;
99 State state_ = State::NO_DEVICE;
100 }; 77 };
101 78
102 } // namespace content 79 } // namespace content
103 80
104 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTUR E_DEVICE_H_ 81 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_VIDEO_CAPTURE_DEVICE_L AUNCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698