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

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

Issue 2738763002: [Mojo Video Capture] Introduce abstraction BuildableVideoCaptureDevice (Closed)
Patch Set: Incorporated miu@'s suggestions from PatchSet 3 Created 3 years, 9 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
emircan 2017/03/16 20:54:03 2017
chfremer 2017/03/16 22:02:29 Done.
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 // DeviceEntryBuilder implementation:
30 void CreateAndStartDeviceAsync(
31 VideoCaptureController* entry,
emircan 2017/03/16 20:54:03 VideoCaptureController* const entry
chfremer 2017/03/16 22:02:29 Actually, now that |entry| and |controller| are th
32 VideoCaptureController* controller,
33 const media::VideoCaptureParams& params,
34 BuildableDeviceCallbacks* callbacks,
35 std::unique_ptr<Ownership> context_reference) override;
36 void ReleaseDeviceAsync(
37 VideoCaptureController* controller,
38 std::unique_ptr<Ownership> context_reference) override;
39 bool IsDeviceAlive() const override;
40 void GetPhotoCapabilities(
41 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback)
42 const override;
43 void SetPhotoOptions(
44 media::mojom::PhotoSettingsPtr settings,
45 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) override;
46 void TakePhoto(
47 media::VideoCaptureDevice::TakePhotoCallback callback) override;
48 void MaybeSuspendDevice() override;
49 void ResumeDevice() override;
50 void RequestRefreshFrame() override;
51
52 void SetDesktopCaptureWindowIdAsync(
53 gfx::NativeViewId window_id,
54 std::unique_ptr<Ownership> context_reference) override;
55
56 private:
57 using ReceiveDeviceCallback =
58 base::Callback<void(std::unique_ptr<media::VideoCaptureDevice> device)>;
59
60 std::unique_ptr<media::VideoCaptureDeviceClient> CreateDeviceClient(
61 int buffer_pool_max_buffer_count,
62 base::WeakPtr<media::VideoFrameReceiver> receiver);
63
64 void OnDeviceStarted(VideoCaptureController* entry,
65 VideoCaptureController* controller,
66 BuildableDeviceCallbacks* callbacks,
67 std::unique_ptr<Ownership> ownership,
68 std::unique_ptr<media::VideoCaptureDevice> device);
69
70 void DoStartDeviceCaptureOnDeviceThread(
71 const media::VideoCaptureDeviceDescriptor& descriptor,
72 const media::VideoCaptureParams& params,
73 std::unique_ptr<media::VideoCaptureDeviceClient> client,
74 ReceiveDeviceCallback result_callback);
75
76 void DoStartTabCaptureOnDeviceThread(
77 const std::string& device_id,
78 const media::VideoCaptureParams& params,
79 std::unique_ptr<media::VideoCaptureDeviceClient> client,
80 ReceiveDeviceCallback result_callback);
81
82 void DoStartDesktopCaptureOnDeviceThread(
83 const std::string& device_id,
84 const media::VideoCaptureParams& params,
85 std::unique_ptr<media::VideoCaptureDeviceClient> client,
86 ReceiveDeviceCallback result_callback);
87
88 void SetDesktopCaptureWindowIdOnDeviceThread(
89 media::VideoCaptureDevice* device,
90 gfx::NativeViewId window_id,
91 std::unique_ptr<Ownership> ownership);
92
93 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
94 media::VideoCaptureDeviceFactory* const device_factory_;
95 std::unique_ptr<media::VideoCaptureDevice> device_;
96 };
97
98 } // namespace content
99
100 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_IN_PROCESS_BUILDABLE_VIDEO_CAPTUR E_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698