Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9488)

Unified Diff: content/browser/renderer_host/media/video_capture_manager.h

Issue 235353002: Extract VideoCaptureDeviceFactory out of VideoCaptureDevice and use for File and FakeVCD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: perkj@ nit Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..387b95e74a11d6ea2b5edf965a22de527d3ec92b 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,10 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
typedef std::set<DeviceEntry*> DeviceEntries;
DeviceEntries devices_;
+ // Device creation factory injected on construction from MediaStreamManager or
+ // from the test harness.
+ 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 +235,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_;

Powered by Google App Engine
This is Rietveld 408576698