Index: media/video/capture/fake_video_capture_device.cc |
diff --git a/media/video/capture/fake_video_capture_device.cc b/media/video/capture/fake_video_capture_device.cc |
index c36670c70e784563c3fa9b677540ae2bab22dd25..b3dc5ddc8c69b2d15b4ef1db2f392022f0ebb1b6 100644 |
--- a/media/video/capture/fake_video_capture_device.cc |
+++ b/media/video/capture/fake_video_capture_device.cc |
@@ -19,15 +19,23 @@ namespace media { |
static const int kFakeCaptureTimeoutMs = 50; |
static const int kFakeCaptureBeepCycle = 20; // Visual beep every 1s. |
static const int kFakeCaptureCapabilityChangePeriod = 30; |
-enum { kNumberOfFakeDevices = 2 }; |
+int FakeVideoCaptureDevice::numberOfFakeDevices = 2; |
bool FakeVideoCaptureDevice::fail_next_create_ = false; |
+void FakeVideoCaptureDevice::SetNumberOfFakeDevices(int num) { |
+ numberOfFakeDevices = num; |
+} |
+ |
+int FakeVideoCaptureDevice::NumberOfFakeDevices(void) { |
+ return numberOfFakeDevices; |
no longer working on chromium
2013/11/12 16:48:00
you are having a getter and setter, probably numbe
mcasas
2013/11/12 18:10:16
Again, is used as a global variable of the whole F
|
+} |
+ |
void FakeVideoCaptureDevice::GetDeviceNames(Names* const device_names) { |
// Empty the name list. |
device_names->erase(device_names->begin(), device_names->end()); |
- for (int n = 0; n < kNumberOfFakeDevices; n++) { |
+ for (int n = 0; n < numberOfFakeDevices; n++) { |
Name name(base::StringPrintf("fake_device_%d", n), |
base::StringPrintf("/dev/video%d", n)); |
device_names->push_back(name); |
@@ -37,12 +45,19 @@ void FakeVideoCaptureDevice::GetDeviceNames(Names* const device_names) { |
void FakeVideoCaptureDevice::GetDeviceSupportedFormats( |
const Name& device, |
VideoCaptureCapabilities* formats) { |
- VideoCaptureCapability capture_format; |
- capture_format.color = media::PIXEL_FORMAT_I420; |
- capture_format.width = 640; |
- capture_format.height = 480; |
- capture_format.frame_rate = 1000 / kFakeCaptureTimeoutMs; |
- formats->push_back(capture_format); |
+ formats->clear(); |
+ VideoCaptureCapability capture_format_640x480; |
+ capture_format_640x480.color = media::PIXEL_FORMAT_I420; |
+ capture_format_640x480.width = 640; |
+ capture_format_640x480.height = 480; |
+ capture_format_640x480.frame_rate = 1000 / kFakeCaptureTimeoutMs; |
+ formats->push_back(capture_format_640x480); |
+ VideoCaptureCapability capture_format_320x240; |
+ capture_format_320x240.color = media::PIXEL_FORMAT_I420; |
+ capture_format_320x240.width = 320; |
+ capture_format_320x240.height = 240; |
+ capture_format_320x240.frame_rate = 1000 / kFakeCaptureTimeoutMs; |
+ formats->push_back(capture_format_320x240); |
} |
VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) { |
@@ -50,7 +65,7 @@ VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) { |
fail_next_create_ = false; |
return NULL; |
} |
- for (int n = 0; n < kNumberOfFakeDevices; ++n) { |
+ for (int n = 0; n < numberOfFakeDevices; ++n) { |
std::string possible_id = base::StringPrintf("/dev/video%d", n); |
if (device_name.id().compare(possible_id) == 0) { |
return new FakeVideoCaptureDevice(); |