Chromium Code Reviews| Index: media/capture/video/fake_video_capture_device_factory.cc |
| diff --git a/media/capture/video/fake_video_capture_device_factory.cc b/media/capture/video/fake_video_capture_device_factory.cc |
| index 38ef6054ecb237593f6ec916050fb036b80aa2b0..eededad717d70976a75cd7f1babec147ef2b88ec 100644 |
| --- a/media/capture/video/fake_video_capture_device_factory.cc |
| +++ b/media/capture/video/fake_video_capture_device_factory.cc |
| @@ -13,6 +13,15 @@ |
| #include "build/build_config.h" |
| #include "media/base/media_switches.h" |
| +namespace { |
| + |
| +media::VideoPixelFormat get_pixelformat(const std::string& device_id) { |
| + if (device_id == "/dev/video1") |
| + return media::PIXEL_FORMAT_Y16; |
| + return media::PIXEL_FORMAT_I420; |
|
mcasas
2016/10/21 00:10:50
Hmm, if you need this specific format type to be g
aleksandar.stojiljkovic
2016/10/21 22:11:10
If it is important that there is only one capture
|
| +} |
| +} |
|
mcasas
2016/10/21 00:10:50
nit: empty line between these }
aleksandar.stojiljkovic
2016/10/21 22:11:10
Done.
aleksandar.stojiljkovic
2016/10/25 21:14:59
git cl format media is just forcing no empty line
|
| + |
| namespace media { |
| // Cap the frame rate command line input to reasonable values. |
| @@ -22,7 +31,13 @@ static const float kFakeCaptureMaxFrameRate = 60.0f; |
| static const float kFakeCaptureDefaultFrameRate = 20.0f; |
| FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory() |
| +#if defined(OS_ANDROID) |
| + // TODO(astojilj): Support 16bpp depth video capture on Android. |
| : number_of_devices_(1), |
| +#else |
| + // First device is I420, second is Y16. See also get_pixelformat(). |
| + : number_of_devices_(2), |
|
mcasas
2016/10/21 00:10:50
Some tests also set_numer_of_devices() to 2, and e
aleksandar.stojiljkovic
2016/10/21 22:11:10
Yes, that's why decided to set it to 2, first RGB,
|
| +#endif |
| fake_vcd_ownership_(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS), |
| frame_rate_(kFakeCaptureDefaultFrameRate) {} |
| @@ -35,8 +50,8 @@ std::unique_ptr<VideoCaptureDevice> FakeVideoCaptureDeviceFactory::CreateDevice( |
| for (int n = 0; n < number_of_devices_; ++n) { |
| std::string possible_id = base::StringPrintf("/dev/video%d", n); |
| if (device_descriptor.device_id.compare(possible_id) == 0) { |
| - return std::unique_ptr<VideoCaptureDevice>( |
| - new FakeVideoCaptureDevice(fake_vcd_ownership_, frame_rate_)); |
| + return std::unique_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice( |
| + fake_vcd_ownership_, frame_rate_, get_pixelformat(possible_id))); |
| } |
| } |
| return std::unique_ptr<VideoCaptureDevice>(); |
| @@ -66,14 +81,14 @@ void FakeVideoCaptureDeviceFactory::GetSupportedFormats( |
| const VideoCaptureDeviceDescriptor& device_descriptor, |
| VideoCaptureFormats* supported_formats) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| - const gfx::Size supported_sizes[] = {gfx::Size(320, 240), |
| - gfx::Size(640, 480), |
| + const gfx::Size supported_sizes[] = {gfx::Size(96, 96), // To test cubemap. |
| + gfx::Size(320, 240), gfx::Size(640, 480), |
|
mcasas
2016/10/21 00:10:50
nit: Indent is strange here.
aleksandar.stojiljkovic
2016/10/21 22:11:10
git cl format media is doing it and complaining if
|
| gfx::Size(1280, 720), |
| gfx::Size(1920, 1080)}; |
| supported_formats->clear(); |
| for (const auto& size : supported_sizes) { |
| - supported_formats->push_back( |
| - VideoCaptureFormat(size, frame_rate_, media::PIXEL_FORMAT_I420)); |
| + supported_formats->push_back(VideoCaptureFormat( |
| + size, frame_rate_, get_pixelformat(device_descriptor.device_id))); |
| } |
| } |