Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_manager.h |
| diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h |
| index 58ed04b6be5e8040f65fca8f6a3ca006a32ff19a..7ada66b27dc63218132ffe9019ec3a4d03db906a 100644 |
| --- a/content/browser/renderer_host/media/video_capture_manager.h |
| +++ b/content/browser/renderer_host/media/video_capture_manager.h |
| @@ -12,6 +12,7 @@ |
| #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| +#include <list> |
| #include <map> |
| #include <set> |
| #include <string> |
| @@ -182,6 +183,19 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| const media::VideoCaptureDeviceInfos& old_device_info_cache, |
| scoped_ptr<media::VideoCaptureDevice::Names> names_snapshot); |
| + // On the OS level, starting a capture device can take 1-2 seconds. |
| + // To avoid multiple unnecessary start/stop commands to the OS, each start |
| + // request is queued in |device_start_queue_|. |
| + // QueueStartDevice creates a new entry in |device_start_queue_| and posts a |
| + // request to start |entry| on the device thread unless there is another |
| + // request pending start. |
| + void QueueStartDevice(media::VideoCaptureSessionId session_id, |
| + DeviceEntry* entry, |
|
tommi (sloooow) - chröme
2014/12/15 16:25:05
can you document the ownership/lifetime of |entry|
|
| + const media::VideoCaptureParams& params); |
| + void OnDeviceStarted(); |
| + void DoStopDevice(DeviceEntry* entry, bool delete_entry); |
| + void HandleQueuedStartRequest(); |
| + |
| // Creates and Starts a new VideoCaptureDevice, storing the result in |
| // |entry->video_capture_device|. Ownership of |client| passes to |
| // the device. |
| @@ -245,8 +259,24 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| scoped_ptr<media::VideoCaptureDevice> video_capture_device; |
| }; |
| typedef std::set<DeviceEntry*> DeviceEntries; |
| + // Currently opened devices. The device may or may not be started. |
| DeviceEntries devices_; |
| + // On the OS level, starting a capture device can take 1-2 seconds. |
| + // To avoid multiple unnecessary start/stop commands to the OS, each start |
| + // request is queued in a CaptureDeviceStartRequest. |
| + struct CaptureDeviceStartRequest { |
| + CaptureDeviceStartRequest(DeviceEntry* device_entry, |
| + media::VideoCaptureSessionId session_id, |
| + const media::VideoCaptureParams& params); |
| + |
| + DeviceEntry* device_entry; |
|
tommi (sloooow) - chröme
2014/12/15 16:25:05
ownership/scope?
|
| + media::VideoCaptureSessionId session_id; |
| + media::VideoCaptureParams params; |
| + }; |
| + typedef std::list<CaptureDeviceStartRequest> DeviceStartQueue; |
| + DeviceStartQueue device_start_queue_; |
| + |
| // Device creation factory injected on construction from MediaStreamManager or |
| // from the test harness. |
| scoped_ptr<media::VideoCaptureDeviceFactory> video_capture_device_factory_; |