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 6f0b0ec4702dedd2e9e2f43caecee942542ec5e8..e4591c0264e882d191136a85b729a64f9b6e07ef 100644 |
| --- a/content/browser/renderer_host/media/video_capture_manager.h |
| +++ b/content/browser/renderer_host/media/video_capture_manager.h |
| @@ -59,7 +59,8 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| // Called by VideoCaptureHost to locate a capture device for |capture_params|, |
| // adding the Host as a client of the device's controller if successful. The |
| // value of |capture_params.session_id| controls which device is selected; |
| - // this value should be a session id previously returned by Open(). |
| + // this value should be a session id previously returned by Open(). The device |
| + // capabilities are reduced to |capture_params|. |
| // |
| // If the device is not already started (i.e., no other client is currently |
| // capturing from this device), this call will cause a VideoCaptureController |
| @@ -82,6 +83,13 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| VideoCaptureControllerID client_id, |
| VideoCaptureControllerEventHandler* client_handler); |
| + // Retrieve the available capture capabilities for a particular device. The |
| + // capabilities are cached during device(s) enumeration and updated as clients |
| + // open the device(s). This call is asynchronous but expected to return fast |
| + // since the capabilities are cached; the reply will be received in |
| + // listener_->DeviceCapabilitiesEnumerated(). |
|
perkj_chrome
2013/10/29 12:13:36
This is not what we discussed. You want to access
|
| + void EnumerateDeviceCapabilities(const StreamDeviceInfo& device_info); |
| + |
| private: |
| virtual ~VideoCaptureManager(); |
| struct DeviceEntry; |
| @@ -96,6 +104,9 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| void OnClosed(MediaStreamType type, int capture_session_id); |
| void OnDevicesEnumerated(MediaStreamType stream_type, |
| const media::VideoCaptureDevice::Names& names); |
| + void OnDeviceCapabilitiesEnumerated( |
| + const StreamDeviceInfo& device_info, |
| + const media::VideoCaptureCapabilities& capabilities); |
| // Find a DeviceEntry by its device ID and type, if it is already opened. |
| DeviceEntry* GetDeviceEntryForMediaStreamDevice( |
| @@ -115,6 +126,10 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| media::VideoCaptureDevice::Names GetAvailableDevicesOnDeviceThread( |
| MediaStreamType stream_type); |
| + // Queries and returns the video capture capabilities of a device. |
| + media::VideoCaptureCapabilities GetDeviceCapabilitiesOnDeviceThread( |
| + const StreamDeviceInfo& device_info); |
| + |
| // Create and Start a new VideoCaptureDevice, storing the result in |
| // |entry->video_capture_device|. Ownership of |client| passes to |
| // the device. |
| @@ -171,11 +186,26 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| // default. This is only used for the MEDIA_DEVICE_VIDEO_CAPTURE device type. |
| bool use_fake_device_; |
| - // We cache the enumerated video capture devices in |
| - // GetAvailableDevicesOnDeviceThread() and then later look up the requested ID |
| - // when a device is created in DoStartDeviceOnDeviceThread(). Used only on the |
| - // device thread. |
| - media::VideoCaptureDevice::Names video_capture_devices_; |
| + // This class is a convenient wrap of a devices' name and associated video |
| + // capture capabilities. |
| + class DeviceInfo { |
|
miu
2013/10/29 18:43:27
C++ style: struct, not class
|
| + public: |
| + DeviceInfo(); |
| + DeviceInfo(const media::VideoCaptureDevice::Name& name, |
| + const media::VideoCaptureCapabilities& capabilities); |
| + ~DeviceInfo(); |
| + |
| + media::VideoCaptureDevice::Name name_; |
| + media::VideoCaptureCapabilities capabilities_; |
| + }; |
| + // Local cache of the enumerated video capture devices' names and capture |
| + // capabilities. This cache is created in GetAvailableDevicesOnDeviceThread() |
| + // and used via requested ID lookup when a device is created in |
| + // DoStartDeviceOnDeviceThread(). The cache is only used in device thread. |
| + // The capabilities are retrieved via EnumerateDeviceCapabilities(). |
| + std::vector<class DeviceInfo> devices_info_cache_; |
|
miu
2013/10/29 18:43:27
remove "class "
miu
2013/10/29 18:43:27
Consider making this a vector<DeviceInfo*> instead
tommi (sloooow) - chröme
2013/10/29 20:26:24
+1.
base::ScopedVector could come in handy:
https:
|
| + class DeviceInfo* FindDeviceInfoById(const std::string& id); |
|
miu
2013/10/29 18:43:27
remove "class "
miu
2013/10/29 18:43:27
C++ style: Move this method up (before data member
|
| + |
| DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| }; |