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

Unified Diff: trunk/src/media/video/capture/fake_video_capture_device.cc

Issue 61213006: Revert 235728 "Removed RunUntilIdle between Stop and Close in UT..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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: trunk/src/media/video/capture/fake_video_capture_device.cc
===================================================================
--- trunk/src/media/video/capture/fake_video_capture_device.cc (revision 235779)
+++ trunk/src/media/video/capture/fake_video_capture_device.cc (working copy)
@@ -19,23 +19,15 @@
static const int kFakeCaptureTimeoutMs = 50;
static const int kFakeCaptureBeepCycle = 20; // Visual beep every 1s.
static const int kFakeCaptureCapabilityChangePeriod = 30;
+enum { kNumberOfFakeDevices = 2 };
-int FakeVideoCaptureDevice::number_of_fake_devices_ = 2;
bool FakeVideoCaptureDevice::fail_next_create_ = false;
-void FakeVideoCaptureDevice::SetNumberOfFakeDevices(int num) {
- number_of_fake_devices_ = num;
-}
-
-int FakeVideoCaptureDevice::NumberOfFakeDevices(void) {
- return number_of_fake_devices_;
-}
-
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 < number_of_fake_devices_; n++) {
+ for (int n = 0; n < kNumberOfFakeDevices; n++) {
Name name(base::StringPrintf("fake_device_%d", n),
base::StringPrintf("/dev/video%d", n));
device_names->push_back(name);
@@ -45,19 +37,12 @@
void FakeVideoCaptureDevice::GetDeviceSupportedFormats(
const Name& device,
VideoCaptureCapabilities* formats) {
- 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);
+ 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);
}
VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) {
@@ -65,7 +50,7 @@
fail_next_create_ = false;
return NULL;
}
- for (int n = 0; n < number_of_fake_devices_; ++n) {
+ for (int n = 0; n < kNumberOfFakeDevices; ++n) {
std::string possible_id = base::StringPrintf("/dev/video%d", n);
if (device_name.id().compare(possible_id) == 0) {
return new FakeVideoCaptureDevice();

Powered by Google App Engine
This is Rietveld 408576698