| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 device_task_runner_ = device_task_runner; | 150 device_task_runner_ = device_task_runner; |
| 151 } | 151 } |
| 152 #endif | 152 #endif |
| 153 | 153 |
| 154 // Returns the SingleThreadTaskRunner where devices are enumerated on and | 154 // Returns the SingleThreadTaskRunner where devices are enumerated on and |
| 155 // started. | 155 // started. |
| 156 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { | 156 scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner() { |
| 157 return device_task_runner_; | 157 return device_task_runner_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool TakePhoto(int session_id, | 160 void TakePhoto(int session_id, |
| 161 const media::VideoCaptureDevice::TakePhotoCallback& | 161 media::ScopedCallback< |
| 162 photo_callback) WARN_UNUSED_RESULT; | 162 media::VideoCaptureDevice::TakePhotoCallback> callback); |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 class DeviceEntry; | 165 class DeviceEntry; |
| 166 | 166 |
| 167 ~VideoCaptureManager() override; | 167 ~VideoCaptureManager() override; |
| 168 | 168 |
| 169 // Checks to see if |entry| has no clients left on its controller. If so, | 169 // Checks to see if |entry| has no clients left on its controller. If so, |
| 170 // remove it from the list of devices, and delete it asynchronously. |entry| | 170 // remove it from the list of devices, and delete it asynchronously. |entry| |
| 171 // may be freed by this function. | 171 // may be freed by this function. |
| 172 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); | 172 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 std::unique_ptr<media::VideoCaptureDevice> | 238 std::unique_ptr<media::VideoCaptureDevice> |
| 239 DoStartDesktopCaptureOnDeviceThread( | 239 DoStartDesktopCaptureOnDeviceThread( |
| 240 const std::string& device_id, | 240 const std::string& device_id, |
| 241 const media::VideoCaptureParams& params, | 241 const media::VideoCaptureParams& params, |
| 242 std::unique_ptr<media::VideoCaptureDevice::Client> client); | 242 std::unique_ptr<media::VideoCaptureDevice::Client> client); |
| 243 | 243 |
| 244 // Stops and destroys the VideoCaptureDevice held in |device|. | 244 // Stops and destroys the VideoCaptureDevice held in |device|. |
| 245 void DoStopDeviceOnDeviceThread( | 245 void DoStopDeviceOnDeviceThread( |
| 246 std::unique_ptr<media::VideoCaptureDevice> device); | 246 std::unique_ptr<media::VideoCaptureDevice> device); |
| 247 | 247 |
| 248 void DoTakePhotoOnDeviceThread( | |
| 249 media::VideoCaptureDevice* device, | |
| 250 const media::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 |