Chromium Code Reviews| 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. | 7 // All functions are expected to be called from Browser::IO thread. |
| 8 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. | 8 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. |
| 9 // A device can only be opened once. | 9 // A device can only be opened once. |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // Only accessed from device thread. | 137 // Only accessed from device thread. |
| 138 // VideoCaptureManager owns all VideoCaptureDevices and is responsible for | 138 // VideoCaptureManager owns all VideoCaptureDevices and is responsible for |
| 139 // deleting the instances when they are not used any longer. | 139 // deleting the instances when they are not used any longer. |
| 140 struct DeviceEntry { | 140 struct DeviceEntry { |
| 141 MediaStreamType stream_type; | 141 MediaStreamType stream_type; |
| 142 media::VideoCaptureDevice* capture_device; // Maybe shared across sessions. | 142 media::VideoCaptureDevice* capture_device; // Maybe shared across sessions. |
| 143 }; | 143 }; |
| 144 typedef std::map<int, DeviceEntry> VideoCaptureDevices; | 144 typedef std::map<int, DeviceEntry> VideoCaptureDevices; |
| 145 VideoCaptureDevices devices_; // Maps capture_session_id to DeviceEntry. | 145 VideoCaptureDevices devices_; // Maps capture_session_id to DeviceEntry. |
| 146 | 146 |
| 147 // Set to true if using fake devices for testing, false by default. | 147 // Set to true if using fake video capture devices for testing, |
| 148 // false by default. This is only used for the MEDIA_DEVICE_VIDEO_CAPTURE | |
| 149 // device type. | |
| 148 bool use_fake_device_; | 150 bool use_fake_device_; |
| 149 | 151 |
| 150 // Only accessed from device thread. | 152 // Only accessed from device thread. |
| 151 // VideoCaptureManager owns all VideoCaptureController's and is responsible | 153 // VideoCaptureManager owns all VideoCaptureController's and is responsible |
| 152 // for deleting the instances when they are not used any longer. | 154 // for deleting the instances when they are not used any longer. |
| 153 // VideoCaptureDevice is one-to-one mapped to VideoCaptureController. | 155 // VideoCaptureDevice is one-to-one mapped to VideoCaptureController. |
| 154 typedef std::map<media::VideoCaptureDevice*, Controller*> Controllers; | 156 typedef std::map<media::VideoCaptureDevice*, Controller*> Controllers; |
| 155 Controllers controllers_; | 157 Controllers controllers_; |
| 156 | 158 |
| 159 // We cache the enumerated video capture devices in GetAvailableDevices | |
| 160 // (e.g. called by OnEnumerateDevices) and then look up the requested ID when | |
| 161 // a device is opened (see OnOpen). | |
| 162 // Used only on the device thread. | |
| 163 media::VideoCaptureDevice::Names video_capture_devices_; | |
| 164 | |
|
mcasas
2013/06/28 07:35:30
Exactly.
| |
| 157 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 165 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| 158 }; | 166 }; |
| 159 | 167 |
| 160 } // namespace content | 168 } // namespace content |
| 161 | 169 |
| 162 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 170 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| OLD | NEW |