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..0d3fa4cda9d39774cc3d24f364052b8123c0843a 100644 |
--- a/content/browser/renderer_host/media/video_capture_manager.h |
+++ b/content/browser/renderer_host/media/video_capture_manager.h |
@@ -17,6 +17,7 @@ |
#include <string> |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_vector.h" |
#include "base/memory/weak_ptr.h" |
#include "base/process/process_handle.h" |
#include "content/browser/renderer_host/media/media_stream_provider.h" |
@@ -59,7 +60,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,9 +84,15 @@ 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 synchronous. |
perkj_chrome
2013/10/31 09:46:00
nit: remove comment about syncrounous. It is obvio
mcasas
2013/10/31 14:25:23
Done.
|
+ media::VideoCaptureCapabilities GetDeviceCapabilities(int capture_session_id); |
+ |
private: |
virtual ~VideoCaptureManager(); |
struct DeviceEntry; |
+ struct DeviceInfo; |
// Check to see if |entry| has no clients left on its controller. If so, |
// remove it from the list of devices, and delete it asynchronously. |entry| |
@@ -120,6 +128,7 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
// the device. |
void DoStartDeviceOnDeviceThread( |
DeviceEntry* entry, |
perkj_chrome
2013/10/31 09:46:00
why both?
mcasas
2013/10/31 14:25:23
See more comments below, changed to const media::V
|
+ DeviceInfo* device_info, |
const media::VideoCaptureCapability& capture_params, |
scoped_ptr<media::VideoCaptureDevice::Client> client); |
@@ -127,6 +136,8 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
// |entry->video_capture_device|. |
void DoStopDeviceOnDeviceThread(DeviceEntry* entry); |
+ DeviceInfo* FindDeviceInfoById(const std::string& id); |
+ |
// The message loop of media stream device thread, where VCD's live. |
scoped_refptr<base::MessageLoopProxy> device_loop_; |
@@ -171,11 +182,23 @@ 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 struct is a convenient wrap of a devices' name and associated video |
+ // capture capabilities. |
+ struct DeviceInfo { |
+ 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 OnDevicesEnumerated() and used via |
+ // requested ID lookup when a device is created in StartCaptureForClient(). |
+ // The cache is only used in Browser::IO thread. The capabilities are |
+ // retrieved by VideoCaptureHost via EnumerateDeviceCapabilities(). |
+ ScopedVector<DeviceInfo> devices_info_cache_; |
DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
}; |