Commit bc2e4b15 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

FakeVideoCaptureDevice: support 4K capture resolution

This CL adds 4K resolution to the Fake Video Capture Device, a.k.a. the
rolling pacman.

TEST= unittests and
./out/desktop/chrome --use-fake-device-for-media-stream https://codepen.io/miguelao/full/bGNgOYq


Bug: 1010457
Change-Id: Ibcab5e83a8bb09dbf4f1e6866951f1ccb9e41f41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1974995
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Auto-Submit: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726603}
parent e2c5558b
......@@ -29,9 +29,9 @@ static const int kDefaultDeviceCount = 1;
static const char* kDefaultDeviceIdMask = "/dev/video%d";
static const media::FakeVideoCaptureDevice::DeliveryMode kDefaultDeliveryMode =
media::FakeVideoCaptureDevice::DeliveryMode::USE_DEVICE_INTERNAL_BUFFERS;
static constexpr std::array<gfx::Size, 5> kDefaultResolutions{
static constexpr std::array<gfx::Size, 6> kDefaultResolutions{
{gfx::Size(96, 96), gfx::Size(320, 240), gfx::Size(640, 480),
gfx::Size(1280, 720), gfx::Size(1920, 1080)}};
gfx::Size(1280, 720), gfx::Size(1920, 1080), gfx::Size(3840, 2160)}};
static constexpr std::array<float, 1> kDefaultFrameRates{{20.0f}};
static const double kInitialPan = 100.0;
......
......@@ -147,6 +147,8 @@ TEST_P(FakeVideoCaptureDeviceTest, CaptureUsing) {
resolutions_to_test.emplace_back(gfx::Size(0, 720), gfx::Size(96, 96));
resolutions_to_test.emplace_back(gfx::Size(1920, 1080),
gfx::Size(1920, 1080));
resolutions_to_test.emplace_back(gfx::Size(3840, 2160),
gfx::Size(3840, 2160));
for (const auto& resolution : resolutions_to_test) {
std::unique_ptr<MockVideoCaptureDeviceClient> client = CreateClient();
......@@ -201,7 +203,7 @@ TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) {
VideoCaptureFormats supported_formats;
video_capture_device_factory_->GetSupportedFormats(descriptors_iterator,
&supported_formats);
ASSERT_EQ(5u, supported_formats.size());
ASSERT_EQ(6u, supported_formats.size());
VideoPixelFormat expected_format =
expected_format_by_device_index[device_index];
EXPECT_EQ(96, supported_formats[0].frame_size.width());
......@@ -224,6 +226,10 @@ TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) {
EXPECT_EQ(1080, supported_formats[4].frame_size.height());
EXPECT_EQ(expected_format, supported_formats[4].pixel_format);
EXPECT_GE(supported_formats[4].frame_rate, 20.0);
EXPECT_EQ(3840, supported_formats[5].frame_size.width());
EXPECT_EQ(2160, supported_formats[5].frame_size.height());
EXPECT_EQ(expected_format, supported_formats[5].pixel_format);
EXPECT_GE(supported_formats[5].frame_rate, 20.0);
device_index++;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment