summaryrefslogtreecommitdiffstats
path: root/media/capture
diff options
context:
space:
mode:
authorvasilii <vasilii@chromium.org>2015-10-20 01:12:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-20 08:13:47 +0000
commitd64c5f6871b71332990f578c26e86998df506695 (patch)
tree27fed1e04a3ea64a52d90a1b7333391fdedef4a6 /media/capture
parent6a1ae72bc6ae077cf239a79cc259d6defb486b2f (diff)
downloadchromium_src-d64c5f6871b71332990f578c26e86998df506695.zip
chromium_src-d64c5f6871b71332990f578c26e86998df506695.tar.gz
chromium_src-d64c5f6871b71332990f578c26e86998df506695.tar.bz2
Revert of Provide configurable fake video device FPS (patchset #7 id:120001 of https://codereview.chromium.org/1398543002/ )
Reason for revert: Performance regression on Linux and Mac. https://build.chromium.org/p/chromium/builders/Linux%20x64/builds/11067 # Static initializers in src/out/Release/chrome: # HINT: To get this list, run tools/linux/dump-static-initializers.py # HINT: diff against the log from the last run to see what changed # atomicops_internals_x86.cc .L.str # atomicops_internals_x86.cc _GLOBAL__sub_I_atomicops_internals_x86.cc+0x78 # atomicops_internals_x86.cc _GLOBAL__sub_I_atomicops_internals_x86.cc+0xed # atomicops_internals_x86.cc (anonymous namespace)::google_initializer_module_atomicops_x86 # atomicops_internals_x86.cc GoogleInitializer::~GoogleInitializer() # atomicops_internals_x86.cc __cxa_atexit@plt [registers a dtor to run at exit] # atomicops_internals_x86.cc __init_array_end+0x2fa8 # atomicops_internals_x86.cc __init_array_end+0x3238 # atomicops_internals_x86.cc __stack_chk_fail@plt # atomicops_internals_x86.cc strcmp@plt # atomicops_internals_x86_gcc.cc .L.str # atomicops_internals_x86_gcc.cc _GLOBAL__sub_I_atomicops_internals_x86_gcc.cc+0x69 # atomicops_internals_x86_gcc.cc _GLOBAL__sub_I_atomicops_internals_x86_gcc.cc+0xb5 # atomicops_internals_x86_gcc.cc google::protobuf::internal::AtomicOps_Internalx86CPUFeatures # atomicops_internals_x86_gcc.cc google::protobuf::internal::AtomicOps_Internalx86CPUFeatures+0x1 # atomicops_internals_x86_gcc.cc __stack_chk_fail@plt # atomicops_internals_x86_gcc.cc strcmp@plt # atomicops_internals_x86_gcc.cc .L.str # atomicops_internals_x86_gcc.cc _GLOBAL__sub_I_atomicops_internals_x86_gcc.cc+0x62 # atomicops_internals_x86_gcc.cc _GLOBAL__sub_I_atomicops_internals_x86_gcc.cc+0x9e # atomicops_internals_x86_gcc.cc v8::base::AtomicOps_Internalx86CPUFeatures # atomicops_internals_x86_gcc.cc __stack_chk_fail@plt # atomicops_internals_x86_gcc.cc strcmp@plt # debugallocation_shim.cc module_enter_exit_hook # debugallocation_shim.cc (anonymous namespace)::large_alloc_threshold # debugallocation_shim.cc TCMallocGuard::TCMallocGuard() # debugallocation_shim.cc __cxa_atexit@plt [registers a dtor to run at exit] # debugallocation_shim.cc __init_array_end+0x3230 # debugallocation_shim.cc __init_array_end+0x3238 # debugallocation_shim.cc __init_array_end+0x3240 # fake_video_capture_device.cc base::time_internal::FromCheckedNumeric(base::internal::CheckedNumeric<long>) # fake_video_capture_device.cc media::kBeepInterval # memory_region_map.cc libpthread_initialized # spinlock.cc _GLOBAL__sub_I_spinlock.cc+0x12 # spinlock.cc NumCPUs() # spinlock.cc adaptive_spin_count # spinlock_internal.cc _GLOBAL__sub_I_spinlock_internal.cc+0x79 # spinlock_internal.cc have_futex # spinlock_internal.cc futex_private_flag # spinlock_internal.cc syscall@plt # Found 40 static initializers in 8 files. Original issue's description: > Provide configurable fake video device FPS > > Previously the fake video device was locked to a 50ms frame interval. This > introduces --use-fake-device-for-media-stream parameters for FPS, buffer > ownership, and buffer planarity. A few example arguments as follows. > --use-fake-device-for-media-stream="fps=30" > --use-fake-device-for-media-stream="ownership=client, planarity=triplanar" > --use-fake-device-for-media-stream="planarity=triplanar, fps=60" > > Comments on changes: > * The capture format reflects the actual rate of the device. Previously 30 FPS > was returned despite the fixed 50 ms frame interval. > * The fake video beeps and draws the pacman at the same rates as before. Beep > timing and pacman angles are calculated from elapsed time instead of a frame > counter. > * Switched the FakeVideoCaptureDevice calculations to use rates instead of > intervals. > > BUG=541632 > > Committed: https://crrev.com/90ba80a98fae5c8c88568c25c802d0219480e88d > Cr-Commit-Position: refs/heads/master@{#354859} TBR=mcasas@chromium.org,nednguyen@google.com,phoglund@chromium.org,edward.baker@intel.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=541632 Review URL: https://codereview.chromium.org/1419533003 Cr-Commit-Position: refs/heads/master@{#355006}
Diffstat (limited to 'media/capture')
-rw-r--r--media/capture/video/fake_video_capture_device.cc58
-rw-r--r--media/capture/video/fake_video_capture_device.h14
-rw-r--r--media/capture/video/fake_video_capture_device_factory.cc76
-rw-r--r--media/capture/video/fake_video_capture_device_factory.h6
-rw-r--r--media/capture/video/fake_video_capture_device_unittest.cc69
5 files changed, 57 insertions, 166 deletions
diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc
index aa5518d..6016c8e 100644
--- a/media/capture/video/fake_video_capture_device.cc
+++ b/media/capture/video/fake_video_capture_device.cc
@@ -16,16 +16,12 @@
namespace media {
-// Sweep at 600 deg/sec.
-static const float kPacmanAngularVelocity = 600;
-// Beep every 500 ms.
-static const base::TimeDelta kBeepInterval =
- base::TimeDelta::FromMilliseconds(500);
+static const int kFakeCaptureBeepCycle = 10; // Visual beep every 0.5s.
void DrawPacman(bool use_argb,
uint8_t* const data,
- base::TimeDelta elapsed_time,
- float frame_rate,
+ int frame_count,
+ int frame_interval,
const gfx::Size& frame_size) {
// |kN32_SkColorType| stands for the appropriiate RGBA/BGRA format.
const SkColorType colorspace =
@@ -49,8 +45,7 @@ void DrawPacman(bool use_argb,
paint.setColor(SK_ColorGREEN);
// Draw a sweeping circle to show an animation.
- const float end_angle =
- fmod(kPacmanAngularVelocity * elapsed_time.InSecondsF(), 361);
+ const int end_angle = (3 * kFakeCaptureBeepCycle * frame_count % 361);
const int radius = std::min(frame_size.width(), frame_size.height()) / 4;
const SkRect rect = SkRect::MakeXYWH(frame_size.width() / 2 - radius,
frame_size.height() / 2 - radius,
@@ -58,11 +53,11 @@ void DrawPacman(bool use_argb,
canvas.drawArc(rect, 0, end_angle, true, paint);
// Draw current time.
- const int milliseconds = elapsed_time.InMilliseconds() % 1000;
- const int seconds = elapsed_time.InSeconds() % 60;
- const int minutes = elapsed_time.InMinutes() % 60;
- const int hours = elapsed_time.InHours();
- const int frame_count = elapsed_time.InMilliseconds() * frame_rate / 1000;
+ const int elapsed_ms = frame_interval * frame_count;
+ const int milliseconds = elapsed_ms % 1000;
+ const int seconds = (elapsed_ms / 1000) % 60;
+ const int minutes = (elapsed_ms / 1000 / 60) % 60;
+ const int hours = (elapsed_ms / 1000 / 60 / 60) % 60;
const std::string time_string =
base::StringPrintf("%d:%02d:%02d:%03d %d", hours, minutes, seconds,
@@ -72,11 +67,10 @@ void DrawPacman(bool use_argb,
}
FakeVideoCaptureDevice::FakeVideoCaptureDevice(BufferOwnership buffer_ownership,
- BufferPlanarity planarity,
- float fake_capture_rate)
+ BufferPlanarity planarity)
: buffer_ownership_(buffer_ownership),
planarity_(planarity),
- fake_capture_rate_(fake_capture_rate),
+ frame_count_(0),
weak_factory_(this) {}
FakeVideoCaptureDevice::~FakeVideoCaptureDevice() {
@@ -93,7 +87,7 @@ void FakeVideoCaptureDevice::AllocateAndStart(
// Incoming |params| can be none of the supported formats, so we get the
// closest thing rounded up. TODO(mcasas): Use the |params|, if they belong to
// the supported ones, when http://crbug.com/309554 is verified.
- capture_format_.frame_rate = fake_capture_rate_;
+ capture_format_.frame_rate = 30.0;
if (params.requested_format.frame_size.width() > 1280)
capture_format_.frame_size.SetSize(1920, 1080);
else if (params.requested_format.frame_size.width() > 640)
@@ -124,9 +118,6 @@ void FakeVideoCaptureDevice::AllocateAndStart(
PIXEL_FORMAT_I420, capture_format_.frame_size)]);
}
- beep_time_ = base::TimeDelta();
- elapsed_time_ = base::TimeDelta();
-
if (buffer_ownership_ == BufferOwnership::CLIENT_BUFFERS)
BeepAndScheduleNextCapture(
base::TimeTicks::Now(),
@@ -150,8 +141,8 @@ void FakeVideoCaptureDevice::CaptureUsingOwnBuffers(
const size_t frame_size = capture_format_.ImageAllocationSize();
memset(fake_frame_.get(), 0, frame_size);
- DrawPacman(false /* use_argb */, fake_frame_.get(), elapsed_time_,
- fake_capture_rate_, capture_format_.frame_size);
+ DrawPacman(false /* use_argb */, fake_frame_.get(), frame_count_,
+ kFakeCapturePeriodMs, capture_format_.frame_size);
// Give the captured frame to the client.
if (planarity_ == BufferPlanarity::PACKED) {
@@ -190,8 +181,8 @@ void FakeVideoCaptureDevice::CaptureUsingClientBuffers(
// Since SkBitmap expects a packed&continuous memory region for I420, we
// need to use |fake_frame_| to draw onto.
memset(fake_frame_.get(), 0, capture_format_.ImageAllocationSize());
- DrawPacman(false /* use_argb */, fake_frame_.get(), elapsed_time_,
- fake_capture_rate_, capture_format_.frame_size);
+ DrawPacman(false /* use_argb */, fake_frame_.get(), frame_count_,
+ kFakeCapturePeriodMs, capture_format_.frame_size);
// Copy data from |fake_frame_| into the reserved planes of GpuMemoryBuffer.
size_t offset = 0;
@@ -208,8 +199,8 @@ void FakeVideoCaptureDevice::CaptureUsingClientBuffers(
DCHECK_EQ(capture_format_.pixel_format, PIXEL_FORMAT_ARGB);
uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data());
memset(data_ptr, 0, capture_buffer->mapped_size());
- DrawPacman(true /* use_argb */, data_ptr, elapsed_time_, fake_capture_rate_,
- capture_format_.frame_size);
+ DrawPacman(true /* use_argb */, data_ptr, frame_count_,
+ kFakeCapturePeriodMs, capture_format_.frame_size);
}
// Give the captured frame to the client.
@@ -225,19 +216,14 @@ void FakeVideoCaptureDevice::CaptureUsingClientBuffers(
void FakeVideoCaptureDevice::BeepAndScheduleNextCapture(
base::TimeTicks expected_execution_time,
const base::Callback<void(base::TimeTicks)>& next_capture) {
- const base::TimeDelta frame_interval =
- base::TimeDelta::FromMicroseconds(1e6 / fake_capture_rate_);
- beep_time_ += frame_interval;
- elapsed_time_ += frame_interval;
-
- // Generate a synchronized beep twice per second.
- if (beep_time_ >= kBeepInterval) {
+ // Generate a synchronized beep sound every so many frames.
+ if (frame_count_++ % kFakeCaptureBeepCycle == 0)
FakeAudioInputStream::BeepOnce();
- beep_time_ -= kBeepInterval;
- }
// Reschedule next CaptureTask.
const base::TimeTicks current_time = base::TimeTicks::Now();
+ const base::TimeDelta frame_interval =
+ base::TimeDelta::FromMilliseconds(kFakeCapturePeriodMs);
// Don't accumulate any debt if we are lagging behind - just post the next
// frame immediately and continue as normal.
const base::TimeTicks next_execution_time =
diff --git a/media/capture/video/fake_video_capture_device.h b/media/capture/video/fake_video_capture_device.h
index 2d8078e..c45bfea 100644
--- a/media/capture/video/fake_video_capture_device.h
+++ b/media/capture/video/fake_video_capture_device.h
@@ -32,11 +32,10 @@ class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice {
TRIPLANAR,
};
+ static int FakeCapturePeriodMs() { return kFakeCapturePeriodMs; }
+
FakeVideoCaptureDevice(BufferOwnership buffer_ownership,
BufferPlanarity planarity);
- FakeVideoCaptureDevice(BufferOwnership buffer_ownership,
- BufferPlanarity planarity,
- float fake_capture_rate);
~FakeVideoCaptureDevice() override;
// VideoCaptureDevice implementation.
@@ -45,6 +44,8 @@ class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice {
void StopAndDeAllocate() override;
private:
+ static const int kFakeCapturePeriodMs = 50;
+
void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time);
void CaptureUsingClientBuffers(base::TimeTicks expected_execution_time);
void BeepAndScheduleNextCapture(
@@ -57,16 +58,11 @@ class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice {
const BufferOwnership buffer_ownership_;
const BufferPlanarity planarity_;
- // Frame rate of the fake video device.
- const float fake_capture_rate_;
scoped_ptr<VideoCaptureDevice::Client> client_;
// |fake_frame_| is used for capturing on Own Buffers.
scoped_ptr<uint8[]> fake_frame_;
- // Time when the next beep occurs.
- base::TimeDelta beep_time_;
- // Time since the fake video started rendering frames.
- base::TimeDelta elapsed_time_;
+ int frame_count_;
VideoCaptureFormat capture_format_;
// FakeVideoCaptureDevice post tasks to itself for frame construction and
diff --git a/media/capture/video/fake_video_capture_device_factory.cc b/media/capture/video/fake_video_capture_device_factory.cc
index 78148f8..d6403ee 100644
--- a/media/capture/video/fake_video_capture_device_factory.cc
+++ b/media/capture/video/fake_video_capture_device_factory.cc
@@ -5,38 +5,40 @@
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "base/command_line.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "media/base/media_switches.h"
+#include "media/capture/video/fake_video_capture_device.h"
namespace media {
-// Cap the frame rate command line input to reasonable values.
-static const float kFakeCaptureMinFrameRate = 5.0f;
-static const float kFakeCaptureMaxFrameRate = 60.0f;
-// Default rate if none is specified as part of the command line.
-static const float kFakeCaptureDefaultFrameRate = 20.0f;
-
FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory()
- : number_of_devices_(1),
- fake_vcd_ownership_(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS),
- fake_vcd_planarity_(FakeVideoCaptureDevice::BufferPlanarity::PACKED),
- frame_rate_(kFakeCaptureDefaultFrameRate) {}
+ : number_of_devices_(1) {
+}
scoped_ptr<VideoCaptureDevice> FakeVideoCaptureDeviceFactory::Create(
const VideoCaptureDevice::Name& device_name) {
DCHECK(thread_checker_.CalledOnValidThread());
- parse_command_line();
+ const std::string option =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseFakeDeviceForMediaStream);
+
+ const FakeVideoCaptureDevice::BufferOwnership fake_vcd_ownership =
+ base::StartsWith(option, "client", base::CompareCase::INSENSITIVE_ASCII)
+ ? FakeVideoCaptureDevice::BufferOwnership::CLIENT_BUFFERS
+ : FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS;
+
+ const FakeVideoCaptureDevice::BufferPlanarity fake_vcd_planarity =
+ base::EndsWith(option, "triplanar", base::CompareCase::INSENSITIVE_ASCII)
+ ? FakeVideoCaptureDevice::BufferPlanarity::TRIPLANAR
+ : FakeVideoCaptureDevice::BufferPlanarity::PACKED;
for (int n = 0; n < number_of_devices_; ++n) {
std::string possible_id = base::StringPrintf("/dev/video%d", n);
if (device_name.id().compare(possible_id) == 0) {
- return scoped_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice(
- fake_vcd_ownership_, fake_vcd_planarity_, frame_rate_));
+ return scoped_ptr<VideoCaptureDevice>(
+ new FakeVideoCaptureDevice(fake_vcd_ownership, fake_vcd_planarity));
}
}
return scoped_ptr<VideoCaptureDevice>();
@@ -71,6 +73,7 @@ void FakeVideoCaptureDeviceFactory::GetDeviceSupportedFormats(
const VideoCaptureDevice::Name& device,
VideoCaptureFormats* supported_formats) {
DCHECK(thread_checker_.CalledOnValidThread());
+ const int frame_rate = 1000 / FakeVideoCaptureDevice::FakeCapturePeriodMs();
const gfx::Size supported_sizes[] = {gfx::Size(320, 240),
gfx::Size(640, 480),
gfx::Size(1280, 720),
@@ -78,46 +81,7 @@ void FakeVideoCaptureDeviceFactory::GetDeviceSupportedFormats(
supported_formats->clear();
for (const auto& size : supported_sizes) {
supported_formats->push_back(
- VideoCaptureFormat(size, frame_rate_, media::PIXEL_FORMAT_I420));
- }
-}
-
-// Optional comma delimited parameters to the command line can specify buffer
-// ownership, buffer planarity, and the fake video device FPS.
-// Examples: "ownership=client, planarity=triplanar, fps=60" "fps=30"
-void FakeVideoCaptureDeviceFactory::parse_command_line() {
- const std::string option =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kUseFakeDeviceForMediaStream);
- base::StringTokenizer option_tokenizer(option, ", ");
- option_tokenizer.set_quote_chars("\"");
-
- while (option_tokenizer.GetNext()) {
- std::vector<std::string> param =
- base::SplitString(option_tokenizer.token(), "=", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_NONEMPTY);
-
- if (param.size() != 2u) {
- LOG(WARNING) << "Forget a value '" << option << "'? Use name=value for "
- << switches::kUseFakeDeviceForMediaStream << ".";
- return;
- }
-
- if (base::EqualsCaseInsensitiveASCII(param.front(), "ownership") &&
- base::EqualsCaseInsensitiveASCII(param.back(), "client")) {
- fake_vcd_ownership_ =
- FakeVideoCaptureDevice::BufferOwnership::CLIENT_BUFFERS;
- } else if (base::EqualsCaseInsensitiveASCII(param.front(), "planarity") &&
- base::EqualsCaseInsensitiveASCII(param.back(), "triplanar")) {
- fake_vcd_planarity_ = FakeVideoCaptureDevice::BufferPlanarity::TRIPLANAR;
- } else if (base::EqualsCaseInsensitiveASCII(param.front(), "fps")) {
- double fps = 0;
- if (base::StringToDouble(param.back(), &fps)) {
- frame_rate_ =
- std::max(kFakeCaptureMinFrameRate, static_cast<float>(fps));
- frame_rate_ = std::min(kFakeCaptureMaxFrameRate, frame_rate_);
- }
- }
+ VideoCaptureFormat(size, frame_rate, media::PIXEL_FORMAT_I420));
}
}
diff --git a/media/capture/video/fake_video_capture_device_factory.h b/media/capture/video/fake_video_capture_device_factory.h
index 9402580..a6de31a 100644
--- a/media/capture/video/fake_video_capture_device_factory.h
+++ b/media/capture/video/fake_video_capture_device_factory.h
@@ -7,7 +7,6 @@
#ifndef MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
#define MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_
-#include "media/capture/video/fake_video_capture_device.h"
#include "media/capture/video/video_capture_device_factory.h"
namespace media {
@@ -37,12 +36,7 @@ class MEDIA_EXPORT FakeVideoCaptureDeviceFactory
}
private:
- void parse_command_line();
-
int number_of_devices_;
- FakeVideoCaptureDevice::BufferOwnership fake_vcd_ownership_;
- FakeVideoCaptureDevice::BufferPlanarity fake_vcd_planarity_;
- float frame_rate_;
};
} // namespace media
diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc
index 22e73ae..e323fe3 100644
--- a/media/capture/video/fake_video_capture_device_unittest.cc
+++ b/media/capture/video/fake_video_capture_device_unittest.cc
@@ -3,12 +3,10 @@
// found in the LICENSE file.
#include "base/bind.h"
-#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/test/test_timeouts.h"
#include "base/threading/thread.h"
-#include "media/base/media_switches.h"
#include "media/base/video_capture_types.h"
#include "media/capture/video/fake_video_capture_device.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
@@ -130,12 +128,15 @@ class DeviceEnumerationListener
} // namespace
-class FakeVideoCaptureDeviceBase : public ::testing::Test {
+class FakeVideoCaptureDeviceTest
+ : public testing::TestWithParam<::testing::tuple<
+ FakeVideoCaptureDevice::BufferOwnership,
+ FakeVideoCaptureDevice::BufferPlanarity>> {
protected:
- FakeVideoCaptureDeviceBase()
+ FakeVideoCaptureDeviceTest()
: loop_(new base::MessageLoop()),
client_(new MockClient(
- base::Bind(&FakeVideoCaptureDeviceBase::OnFrameCaptured,
+ base::Bind(&FakeVideoCaptureDeviceTest::OnFrameCaptured,
base::Unretained(this)))),
video_capture_device_factory_(new FakeVideoCaptureDeviceFactory()) {
device_enumeration_listener_ = new DeviceEnumerationListener();
@@ -176,42 +177,23 @@ class FakeVideoCaptureDeviceBase : public ::testing::Test {
const scoped_ptr<VideoCaptureDeviceFactory> video_capture_device_factory_;
};
-class FakeVideoCaptureDeviceTest
- : public FakeVideoCaptureDeviceBase,
- public ::testing::WithParamInterface<
- ::testing::tuple<FakeVideoCaptureDevice::BufferOwnership,
- FakeVideoCaptureDevice::BufferPlanarity,
- float>> {};
-
-struct CommandLineTestData {
- // Command line argument
- std::string argument;
- // Expected values
- float fps;
-};
-
-class FakeVideoCaptureDeviceCommandLineTest
- : public FakeVideoCaptureDeviceBase,
- public ::testing::WithParamInterface<CommandLineTestData> {};
-
TEST_P(FakeVideoCaptureDeviceTest, CaptureUsing) {
const scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices());
ASSERT_FALSE(names->empty());
scoped_ptr<VideoCaptureDevice> device(new FakeVideoCaptureDevice(
- testing::get<0>(GetParam()), testing::get<1>(GetParam()),
- testing::get<2>(GetParam())));
+ testing::get<0>(GetParam()), testing::get<1>(GetParam())));
ASSERT_TRUE(device);
VideoCaptureParams capture_params;
capture_params.requested_format.frame_size.SetSize(640, 480);
- capture_params.requested_format.frame_rate = testing::get<2>(GetParam());
+ capture_params.requested_format.frame_rate = 30;
device->AllocateAndStart(capture_params, client_.Pass());
WaitForCapturedFrame();
EXPECT_EQ(last_format().frame_size.width(), 640);
EXPECT_EQ(last_format().frame_size.height(), 480);
- EXPECT_EQ(last_format().frame_rate, testing::get<2>(GetParam()));
+ EXPECT_EQ(last_format().frame_rate, 30.0);
device->StopAndDeAllocate();
}
@@ -221,8 +203,7 @@ INSTANTIATE_TEST_CASE_P(
Combine(Values(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS,
FakeVideoCaptureDevice::BufferOwnership::CLIENT_BUFFERS),
Values(FakeVideoCaptureDevice::BufferPlanarity::PACKED,
- FakeVideoCaptureDevice::BufferPlanarity::TRIPLANAR),
- Values(20, 29.97, 30, 50, 60)));
+ FakeVideoCaptureDevice::BufferPlanarity::TRIPLANAR)));
TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) {
scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices());
@@ -252,34 +233,4 @@ TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) {
}
}
-TEST_P(FakeVideoCaptureDeviceCommandLineTest, FrameRate) {
- base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kUseFakeDeviceForMediaStream, GetParam().argument);
- const scoped_ptr<VideoCaptureDevice::Names> names(EnumerateDevices());
- ASSERT_FALSE(names->empty());
-
- for (const auto& names_iterator : *names) {
- scoped_ptr<VideoCaptureDevice> device =
- video_capture_device_factory_->Create(names_iterator);
- ASSERT_TRUE(device);
-
- VideoCaptureParams capture_params;
- capture_params.requested_format.frame_size.SetSize(1280, 720);
- capture_params.requested_format.frame_rate = GetParam().fps;
- device->AllocateAndStart(capture_params, client_.Pass());
-
- WaitForCapturedFrame();
- EXPECT_EQ(last_format().frame_size.width(), 1280);
- EXPECT_EQ(last_format().frame_size.height(), 720);
- EXPECT_EQ(last_format().frame_rate, GetParam().fps);
- device->StopAndDeAllocate();
- }
-}
-
-INSTANTIATE_TEST_CASE_P(,
- FakeVideoCaptureDeviceCommandLineTest,
- Values(CommandLineTestData{"fps=-1", 5},
- CommandLineTestData{"fps=29.97", 29.97},
- CommandLineTestData{"fps=60", 60},
- CommandLineTestData{"fps=1000", 60}));
}; // namespace media