summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authormcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 15:45:49 +0000
committermcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 15:45:49 +0000
commite4af9a823f34e9a5a69ee65836a45e5fc570590a (patch)
treee1966ef3df45c09c33d278aa82c3c602b2b865b7 /content
parentcb4b13e72ade791d7dc2bc88bf54007a53ce9bfc (diff)
downloadchromium_src-e4af9a823f34e9a5a69ee65836a45e5fc570590a.zip
chromium_src-e4af9a823f34e9a5a69ee65836a45e5fc570590a.tar.gz
chromium_src-e4af9a823f34e9a5a69ee65836a45e5fc570590a.tar.bz2
Debug video capture device to play back y4m movies.
For video quality and performance testing. Based on a new command line flag: --use-file-for-fake-video-capture=blabla.y4m (Where blabla.y4m is the full path to the file to play) This flag _must_ be used in combination with the existing: --use-fake-device-for-media-stream The file format can be found described in the code and also here: http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 And many examples here: http://media.xiph.org/video/derf/ (Only 420 would work -- 422 is _not_ supported). With these command line flag, navigating to a web site, f.e. http://goo.gl/qdwf6, and allowing using the camera, will playback the video in a loop, as opposed to a fake camera or a real camera stream. BUG=318797 Review URL: https://codereview.chromium.org/61833011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238973 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/media/video_capture_manager.cc42
-rw-r--r--content/browser/renderer_host/media/video_capture_manager.h12
2 files changed, 42 insertions, 12 deletions
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index 0bda4fd..ff71016 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -19,8 +19,10 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/desktop_media_id.h"
#include "content/public/common/media_stream_request.h"
+#include "media/base/media_switches.h"
#include "media/base/scoped_histogram_timer.h"
#include "media/video/capture/fake_video_capture_device.h"
+#include "media/video/capture/file_video_capture_device.h"
#include "media/video/capture/video_capture_device.h"
#if defined(ENABLE_SCREEN_CAPTURE)
@@ -45,7 +47,7 @@ VideoCaptureManager::DeviceEntry::~DeviceEntry() {}
VideoCaptureManager::VideoCaptureManager()
: listener_(NULL),
new_capture_session_id_(1),
- use_fake_device_(false) {
+ artificial_device_source_for_testing_ (DISABLED) {
}
VideoCaptureManager::~VideoCaptureManager() {
@@ -131,7 +133,12 @@ void VideoCaptureManager::Close(int capture_session_id) {
}
void VideoCaptureManager::UseFakeDevice() {
- use_fake_device_ = true;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseFileForFakeVideoCapture)) {
+ artificial_device_source_for_testing_ = Y4M_FILE;
+ } else {
+ artificial_device_source_for_testing_ = TEST_PATTERN;
+ }
}
void VideoCaptureManager::DoStartDeviceOnDeviceThread(
@@ -150,9 +157,20 @@ void VideoCaptureManager::DoStartDeviceOnDeviceThread(
media::VideoCaptureDevice::Name* found =
video_capture_devices_.FindById(entry->id);
if (found) {
- video_capture_device.reset(use_fake_device_ ?
- media::FakeVideoCaptureDevice::Create(*found) :
- media::VideoCaptureDevice::Create(*found));
+ switch (artificial_device_source_for_testing_) {
+ case DISABLED:
+ video_capture_device.reset(
+ media::VideoCaptureDevice::Create(*found));
+ break;
+ case TEST_PATTERN:
+ video_capture_device.reset(
+ media::FakeVideoCaptureDevice::Create(*found));
+ break;
+ case Y4M_FILE:
+ video_capture_device.reset(
+ media::FileVideoCaptureDevice::Create(*found));
+ break;
+ }
}
break;
}
@@ -320,10 +338,16 @@ VideoCaptureManager::GetAvailableDevicesOnDeviceThread(
// Cache the latest enumeration of video capture devices.
// We'll refer to this list again in OnOpen to avoid having to
// enumerate the devices again.
- if (!use_fake_device_) {
- media::VideoCaptureDevice::GetDeviceNames(&result);
- } else {
- media::FakeVideoCaptureDevice::GetDeviceNames(&result);
+ switch (artificial_device_source_for_testing_) {
+ case DISABLED:
+ media::VideoCaptureDevice::GetDeviceNames(&result);
+ break;
+ case TEST_PATTERN:
+ media::FakeVideoCaptureDevice::GetDeviceNames(&result);
+ break;
+ case Y4M_FILE:
+ media::FileVideoCaptureDevice::GetDeviceNames(&result);
+ break;
}
// TODO(nick): The correctness of device start depends on this cache being
diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h
index 67dbb75..82c6153 100644
--- a/content/browser/renderer_host/media/video_capture_manager.h
+++ b/content/browser/renderer_host/media/video_capture_manager.h
@@ -168,9 +168,15 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
typedef std::set<DeviceEntry*> DeviceEntries;
DeviceEntries devices_;
- // Set to true if using fake video capture devices for testing, false by
- // default. This is only used for the MEDIA_DEVICE_VIDEO_CAPTURE device type.
- bool use_fake_device_;
+ // 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_;
// We cache the enumerated video capture devices in
// GetAvailableDevicesOnDeviceThread() and then later look up the requested ID