| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 scoped_ptr<media::VideoCaptureDevice::Client> client); | 216 scoped_ptr<media::VideoCaptureDevice::Client> client); |
| 217 | 217 |
| 218 // Stops and destroys the VideoCaptureDevice held in | 218 // Stops and destroys the VideoCaptureDevice held in |
| 219 // |device|. | 219 // |device|. |
| 220 void DoStopDeviceOnDeviceThread(scoped_ptr<media::VideoCaptureDevice> device); | 220 void DoStopDeviceOnDeviceThread(scoped_ptr<media::VideoCaptureDevice> device); |
| 221 | 221 |
| 222 media::VideoCaptureDeviceInfo* FindDeviceInfoById( | 222 media::VideoCaptureDeviceInfo* FindDeviceInfoById( |
| 223 const std::string& id, | 223 const std::string& id, |
| 224 media::VideoCaptureDeviceInfos& device_vector); | 224 media::VideoCaptureDeviceInfos& device_vector); |
| 225 | 225 |
| 226 void MaybePostDesktopCaptureWindowId(media::VideoCaptureSessionId session_id); |
| 226 void SetDesktopCaptureWindowIdOnDeviceThread( | 227 void SetDesktopCaptureWindowIdOnDeviceThread( |
| 227 media::VideoCaptureDevice* device, | 228 media::VideoCaptureDevice* device, |
| 228 gfx::NativeViewId window_id); | 229 gfx::NativeViewId window_id); |
| 229 | 230 |
| 230 void SaveDesktopCaptureWindowIdOnDeviceThread( | |
| 231 media::VideoCaptureSessionId session_id, | |
| 232 gfx::NativeViewId window_id); | |
| 233 | |
| 234 // The message loop of media stream device thread, where VCD's live. | 231 // The message loop of media stream device thread, where VCD's live. |
| 235 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 232 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
| 236 | 233 |
| 237 // Only accessed on Browser::IO thread. | 234 // Only accessed on Browser::IO thread. |
| 238 MediaStreamProviderListener* listener_; | 235 MediaStreamProviderListener* listener_; |
| 239 media::VideoCaptureSessionId new_capture_session_id_; | 236 media::VideoCaptureSessionId new_capture_session_id_; |
| 240 | 237 |
| 241 typedef std::map<media::VideoCaptureSessionId, MediaStreamDevice> SessionMap; | 238 typedef std::map<media::VideoCaptureSessionId, MediaStreamDevice> SessionMap; |
| 242 // An entry is kept in this map for every session that has been created via | 239 // An entry is kept in this map for every session that has been created via |
| 243 // the Open() entry point. The keys are session_id's. This map is used to | 240 // the Open() entry point. The keys are session_id's. This map is used to |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 314 |
| 318 // Local cache of the enumerated video capture devices' names and capture | 315 // Local cache of the enumerated video capture devices' names and capture |
| 319 // supported formats. A snapshot of the current devices and their capabilities | 316 // supported formats. A snapshot of the current devices and their capabilities |
| 320 // is composed in VideoCaptureDeviceFactory::EnumerateDeviceNames() and | 317 // is composed in VideoCaptureDeviceFactory::EnumerateDeviceNames() and |
| 321 // ConsolidateDevicesInfoOnDeviceThread(), and this snapshot is used to update | 318 // ConsolidateDevicesInfoOnDeviceThread(), and this snapshot is used to update |
| 322 // this list in OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will | 319 // this list in OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will |
| 323 // use this list if the device is not started, otherwise it will retrieve the | 320 // use this list if the device is not started, otherwise it will retrieve the |
| 324 // active device capture format from the VideoCaptureController associated. | 321 // active device capture format from the VideoCaptureController associated. |
| 325 media::VideoCaptureDeviceInfos devices_info_cache_; | 322 media::VideoCaptureDeviceInfos devices_info_cache_; |
| 326 | 323 |
| 327 // Accessed on the device thread only. | 324 // Map used by DesktopCapture. |
| 328 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 325 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
| 329 notification_window_ids_; | 326 notification_window_ids_; |
| 330 | 327 |
| 331 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 328 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| 332 }; | 329 }; |
| 333 | 330 |
| 334 } // namespace content | 331 } // namespace content |
| 335 | 332 |
| 336 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 333 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| OLD | NEW |