OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureManager is used to open/close, start/stop, enumerate available | 5 // VideoCaptureManager is used to open/close, start/stop, enumerate available |
6 // video capture devices, and manage VideoCaptureController's. | 6 // video capture devices, and manage VideoCaptureController's. |
7 // All functions are expected to be called from Browser::IO thread. Some helper | 7 // All functions are expected to be called from Browser::IO thread. Some helper |
8 // functions (*OnDeviceThread) will dispatch operations to the device thread. | 8 // functions (*OnDeviceThread) will dispatch operations to the device thread. |
9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. | 9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. |
10 // A device can only be opened once. | 10 // A device can only be opened once. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Sets the platform-dependent window ID for the desktop capture notification | 127 // Sets the platform-dependent window ID for the desktop capture notification |
128 // UI for the given session. | 128 // UI for the given session. |
129 void SetDesktopCaptureWindowId(media::VideoCaptureSessionId session_id, | 129 void SetDesktopCaptureWindowId(media::VideoCaptureSessionId session_id, |
130 gfx::NativeViewId window_id); | 130 gfx::NativeViewId window_id); |
131 | 131 |
132 // Gets a weak reference to the device factory, used for tests. | 132 // Gets a weak reference to the device factory, used for tests. |
133 media::VideoCaptureDeviceFactory* video_capture_device_factory() const { | 133 media::VideoCaptureDeviceFactory* video_capture_device_factory() const { |
134 return video_capture_device_factory_.get(); | 134 return video_capture_device_factory_.get(); |
135 } | 135 } |
136 | 136 |
137 #if defined(OS_WIN) | |
138 void set_device_task_runner( | |
139 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner) { | |
140 device_task_runner_ = device_task_runner; | |
141 } | |
142 #endif | |
143 | |
144 // Returns the SingleThreadTaskRunner where devices are enumerated on and | 137 // Returns the SingleThreadTaskRunner where devices are enumerated on and |
145 // started. | 138 // started. |
146 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { | 139 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { |
147 return device_task_runner_; | 140 return device_task_runner_; |
148 } | 141 } |
| 142 |
149 private: | 143 private: |
150 ~VideoCaptureManager() override; | 144 ~VideoCaptureManager() override; |
151 class DeviceEntry; | 145 class DeviceEntry; |
152 | 146 |
153 // Checks to see if |entry| has no clients left on its controller. If so, | 147 // Checks to see if |entry| has no clients left on its controller. If so, |
154 // remove it from the list of devices, and delete it asynchronously. |entry| | 148 // remove it from the list of devices, and delete it asynchronously. |entry| |
155 // may be freed by this function. | 149 // may be freed by this function. |
156 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); | 150 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); |
157 | 151 |
158 // Helpers to report an event to our Listener. | 152 // Helpers to report an event to our Listener. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // Map used by DesktopCapture. | 318 // Map used by DesktopCapture. |
325 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 319 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
326 notification_window_ids_; | 320 notification_window_ids_; |
327 | 321 |
328 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 322 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
329 }; | 323 }; |
330 | 324 |
331 } // namespace content | 325 } // namespace content |
332 | 326 |
333 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 327 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
OLD | NEW |