OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 #include "content/browser/renderer_host/media/video_capture_device_entry.h" | |
6 | |
7 namespace { | |
8 | |
9 // Counter used for identifying a DeviceRequest to start a capture device. | |
10 static int g_device_start_id = 0; | |
11 } | |
12 | |
13 namespace content { | |
14 | |
15 VideoCaptureDeviceEntry::VideoCaptureDeviceEntry( | |
16 const std::string& id, | |
17 MediaStreamType stream_type, | |
18 const media::VideoCaptureParams& params, | |
19 std::unique_ptr<BuildableVideoCaptureDevice> buildable_device) | |
20 : serial_id_(g_device_start_id++), | |
21 id_(id), | |
22 stream_type_(stream_type), | |
23 parameters_(params), | |
24 buildable_device_(std::move(buildable_device)) {} | |
25 | |
26 VideoCaptureDeviceEntry::~VideoCaptureDeviceEntry() = default; | |
27 | |
28 void VideoCaptureDeviceEntry::CreateAndStartDeviceAsync( | |
miu
2017/03/11 01:13:22
It looks like every method in this class is just a
chfremer
2017/03/13 22:02:03
I agree that this class, now that all interesting
| |
29 const media::VideoCaptureParams& params, | |
30 BuildableDeviceCallbacks* callbacks, | |
31 std::unique_ptr<Ownership> context_reference) { | |
32 buildable_device_->CreateAndStartDeviceAsync( | |
33 this, &controller_, params, callbacks, std::move(context_reference)); | |
34 } | |
35 | |
36 void VideoCaptureDeviceEntry::ReleaseDeviceAsync( | |
37 std::unique_ptr<Ownership> context_reference) { | |
38 buildable_device_->ReleaseDeviceAsync(&controller_, | |
39 std::move(context_reference)); | |
40 } | |
41 | |
42 void VideoCaptureDeviceEntry::OnLog(const std::string& message) { | |
43 controller_.OnLog(message); | |
44 } | |
45 | |
46 void VideoCaptureDeviceEntry::OnError() { | |
47 controller_.OnError(); | |
48 } | |
49 | |
50 bool VideoCaptureDeviceEntry::HasDevice() const { | |
51 return buildable_device_->HasDevice(); | |
52 } | |
53 | |
54 bool VideoCaptureDeviceEntry::CorrespondsToController( | |
55 const VideoCaptureController* controller) const { | |
56 return &controller_ == controller; | |
57 } | |
58 | |
59 bool VideoCaptureDeviceEntry::HasActiveClient() { | |
60 return controller_.HasActiveClient(); | |
61 } | |
62 | |
63 bool VideoCaptureDeviceEntry::HasPausedClient() { | |
64 return controller_.HasPausedClient(); | |
65 } | |
66 | |
67 void VideoCaptureDeviceEntry::AddClient( | |
68 VideoCaptureControllerID id, | |
69 VideoCaptureControllerEventHandler* event_handler, | |
70 media::VideoCaptureSessionId session_id, | |
71 const media::VideoCaptureParams& params) { | |
72 controller_.AddClient(id, event_handler, session_id, params); | |
73 } | |
74 | |
75 void VideoCaptureDeviceEntry::StopSession(int session_id) { | |
76 controller_.StopSession(session_id); | |
77 } | |
78 | |
79 base::WeakPtr<VideoCaptureController> | |
80 VideoCaptureDeviceEntry::GetControllerWeakPtrForIOThread() { | |
81 return controller_.GetWeakPtrForIOThread(); | |
82 } | |
83 | |
84 media::VideoCaptureFormat VideoCaptureDeviceEntry::GetVideoCaptureFormat() { | |
85 return controller_.GetVideoCaptureFormat(); | |
86 } | |
87 | |
88 void VideoCaptureDeviceEntry::GetPhotoCapabilities( | |
89 media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback) const { | |
90 buildable_device_->GetPhotoCapabilities(std::move(callback)); | |
91 } | |
92 | |
93 void VideoCaptureDeviceEntry::SetPhotoOptions( | |
94 media::mojom::PhotoSettingsPtr settings, | |
95 media::VideoCaptureDevice::SetPhotoOptionsCallback callback) { | |
96 buildable_device_->SetPhotoOptions(std::move(settings), std::move(callback)); | |
97 } | |
98 | |
99 void VideoCaptureDeviceEntry::TakePhoto( | |
100 media::VideoCaptureDevice::TakePhotoCallback callback) { | |
101 buildable_device_->TakePhoto(std::move(callback)); | |
102 } | |
103 | |
104 void VideoCaptureDeviceEntry::MaybeSuspend() { | |
105 buildable_device_->MaybeSuspendDevice(); | |
106 } | |
107 | |
108 void VideoCaptureDeviceEntry::Resume() { | |
109 buildable_device_->ResumeDevice(); | |
110 } | |
111 | |
112 void VideoCaptureDeviceEntry::RequestRefreshFrame() { | |
113 buildable_device_->RequestRefreshFrame(); | |
114 } | |
115 | |
116 void VideoCaptureDeviceEntry::SetDesktopCaptureWindowIdAsync( | |
117 gfx::NativeViewId window_id, | |
118 std::unique_ptr<Ownership> context_reference) { | |
119 buildable_device_->SetDesktopCaptureWindowIdAsync( | |
120 window_id, std::move(context_reference)); | |
121 } | |
122 | |
123 } // namespace content | |
OLD | NEW |