| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 device_task_runner_ = device_task_runner; | 152 device_task_runner_ = device_task_runner; |
| 153 } | 153 } |
| 154 #endif | 154 #endif |
| 155 | 155 |
| 156 // Returns the SingleThreadTaskRunner where devices are enumerated on and | 156 // Returns the SingleThreadTaskRunner where devices are enumerated on and |
| 157 // started. | 157 // started. |
| 158 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { | 158 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { |
| 159 return device_task_runner_; | 159 return device_task_runner_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool TakePhoto(int session_id, | 162 void TakePhoto(int session_id, |
| 163 const VideoCaptureDevice::TakePhotoCallback& photo_callback) | 163 media::ScopedResultCallback< |
| 164 WARN_UNUSED_RESULT; | 164 VideoCaptureDevice::TakePhotoCallback> callback); |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 class DeviceEntry; | 167 class DeviceEntry; |
| 168 | 168 |
| 169 ~VideoCaptureManager() override; | 169 ~VideoCaptureManager() override; |
| 170 | 170 |
| 171 // Checks to see if |entry| has no clients left on its controller. If so, | 171 // Checks to see if |entry| has no clients left on its controller. If so, |
| 172 // remove it from the list of devices, and delete it asynchronously. |entry| | 172 // remove it from the list of devices, and delete it asynchronously. |entry| |
| 173 // may be freed by this function. | 173 // may be freed by this function. |
| 174 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); | 174 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 std::unique_ptr<VideoCaptureDevice::Client> client); | 238 std::unique_ptr<VideoCaptureDevice::Client> client); |
| 239 | 239 |
| 240 std::unique_ptr<VideoCaptureDevice> DoStartDesktopCaptureOnDeviceThread( | 240 std::unique_ptr<VideoCaptureDevice> DoStartDesktopCaptureOnDeviceThread( |
| 241 const std::string& device_id, | 241 const std::string& device_id, |
| 242 const media::VideoCaptureParams& params, | 242 const media::VideoCaptureParams& params, |
| 243 std::unique_ptr<VideoCaptureDevice::Client> client); | 243 std::unique_ptr<VideoCaptureDevice::Client> client); |
| 244 | 244 |
| 245 // Stops and destroys the VideoCaptureDevice held in |device|. | 245 // Stops and destroys the VideoCaptureDevice held in |device|. |
| 246 void DoStopDeviceOnDeviceThread(std::unique_ptr<VideoCaptureDevice> device); | 246 void DoStopDeviceOnDeviceThread(std::unique_ptr<VideoCaptureDevice> device); |
| 247 | 247 |
| 248 void DoTakePhotoOnDeviceThread( | |
| 249 media::VideoCaptureDevice* device, | |
| 250 const VideoCaptureDevice::TakePhotoCallback& photo_callback); | |
| 251 | |
| 252 media::VideoCaptureDeviceInfo* FindDeviceInfoById( | 248 media::VideoCaptureDeviceInfo* FindDeviceInfoById( |
| 253 const std::string& id, | 249 const std::string& id, |
| 254 media::VideoCaptureDeviceInfos& device_vector); | 250 media::VideoCaptureDeviceInfos& device_vector); |
| 255 | 251 |
| 256 void MaybePostDesktopCaptureWindowId(media::VideoCaptureSessionId session_id); | 252 void MaybePostDesktopCaptureWindowId(media::VideoCaptureSessionId session_id); |
| 257 void SetDesktopCaptureWindowIdOnDeviceThread( | 253 void SetDesktopCaptureWindowIdOnDeviceThread( |
| 258 media::VideoCaptureDevice* device, | 254 media::VideoCaptureDevice* device, |
| 259 gfx::NativeViewId window_id); | 255 gfx::NativeViewId window_id); |
| 260 | 256 |
| 261 #if defined(OS_MACOSX) | 257 #if defined(OS_MACOSX) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // Map used by DesktopCapture. | 326 // Map used by DesktopCapture. |
| 331 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 327 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
| 332 notification_window_ids_; | 328 notification_window_ids_; |
| 333 | 329 |
| 334 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 330 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| 335 }; | 331 }; |
| 336 | 332 |
| 337 } // namespace content | 333 } // namespace content |
| 338 | 334 |
| 339 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 335 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| OLD | NEW |