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

Unified Diff: media/capture/video/fake_video_capture_device_factory.cc

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 months 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: 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..1b68e54928ded99166e1900e73dd88b57cc6cf83 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;
+}
+}
+
namespace media {
// Cap the frame rate command line input to reasonable values.
@@ -22,7 +31,7 @@ static const float kFakeCaptureMaxFrameRate = 60.0f;
static const float kFakeCaptureDefaultFrameRate = 20.0f;
FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory()
- : number_of_devices_(1),
+ : number_of_devices_(2),
fake_vcd_ownership_(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS),
frame_rate_(kFakeCaptureDefaultFrameRate) {}
@@ -35,8 +44,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 +75,15 @@ void FakeVideoCaptureDeviceFactory::GetSupportedFormats(
const VideoCaptureDeviceDescriptor& device_descriptor,
VideoCaptureFormats* supported_formats) {
DCHECK(thread_checker_.CalledOnValidThread());
- const gfx::Size supported_sizes[] = {gfx::Size(320, 240),
+ const gfx::Size supported_sizes[] = {gfx::Size(96, 96), // To test cubemap.
+ gfx::Size(320, 240),
gfx::Size(640, 480),
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)));
}
}
« no previous file with comments | « media/capture/video/fake_video_capture_device.cc ('k') | media/capture/video/fake_video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698