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 35aee8eba235ef42c49b1fae80e37feb8b17652f..93ddbcf4f61582e507c0eb44ebe0d0a98befd3a2 100644 |
--- a/content/browser/renderer_host/media/video_capture_manager.h |
+++ b/content/browser/renderer_host/media/video_capture_manager.h |
@@ -24,6 +24,7 @@ |
#include "content/common/content_export.h" |
#include "content/common/media/media_stream_options.h" |
#include "media/video/capture/video_capture_device.h" |
+#include "media/video/capture/video_capture_device_factory.h" |
#include "media/video/capture/video_capture_types.h" |
namespace content { |
@@ -37,7 +38,8 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
typedef base::Callback< |
void(const base::WeakPtr<VideoCaptureController>&)> DoneCB; |
- VideoCaptureManager(); |
+ explicit VideoCaptureManager( |
+ scoped_ptr<media::VideoCaptureDeviceFactory> factory); |
// Implements MediaStreamProvider. |
virtual void Register(MediaStreamProviderListener* listener, |
@@ -52,11 +54,6 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
virtual void Close(int capture_session_id) OVERRIDE; |
- // Used by unit test to make sure a fake device is used instead of a real |
- // video capture device. Due to timing requirements, the function must be |
- // called before EnumerateDevices and Open. |
- void UseFakeDevice(); |
- |
// 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 |session_id| controls which device is selected; |
@@ -103,6 +100,11 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
void SetDesktopCaptureWindowId(media::VideoCaptureSessionId session_id, |
gfx::NativeViewId window_id); |
+ // Gets a weak reference to the device factory, used for tests. |
+ media::VideoCaptureDeviceFactory* video_capture_device_factory() const { |
+ return video_capture_device_factory_.get(); |
+ } |
+ |
private: |
virtual ~VideoCaptureManager(); |
struct DeviceEntry; |
@@ -220,6 +222,12 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
typedef std::set<DeviceEntry*> DeviceEntries; |
DeviceEntries devices_; |
+ // Device creation factory injected from Media Stream Manager or from the test |
perkj_chrome
2014/04/24 14:43:32
MediaStreamManager + please update the description
mcasas
2014/04/24 20:20:26
Done.
|
+ // harness. Supported fake devices include a simple fake device (a rolling |
+ // pacman), or a file that is played in a loop continuously. Test device is |
+ // only and always of type MEDIA_DEVICE_VIDEO_CAPTURE. |
+ scoped_ptr<media::VideoCaptureDeviceFactory> video_capture_device_factory_; |
+ |
// Local cache of the enumerated video capture devices' names and capture |
// supported formats. A snapshot of the current devices and their capabilities |
// is composed in GetAvailableDevicesInfoOnDeviceThread() --coming |
@@ -229,16 +237,6 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
// active device capture format from the VideoCaptureController associated. |
DeviceInfos devices_info_cache_; |
- // For unit testing and for performance/quality tests, a test device can be |
- // used instead of a real one. The device can be a simple fake device (a |
- // rolling pacman), or a file that is played in a loop continuously. This only |
- // applies to the MEDIA_DEVICE_VIDEO_CAPTURE device type. |
- enum { |
- DISABLED, |
- TEST_PATTERN, |
- Y4M_FILE |
- } artificial_device_source_for_testing_; |
- |
// Accessed on the device thread only. |
std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
notification_window_ids_; |