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

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

Issue 2712123003: Revert of Add MJPEG support to FakeVideoCaptureDevice (Closed)
Patch Set: Created 3 years, 10 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 5b850e6470453fbccd59c9222c22b06075a781b2..49df8e6b962a159f5997396eb98e194e31224032 100644
--- a/media/capture/video/fake_video_capture_device_factory.cc
+++ b/media/capture/video/fake_video_capture_device_factory.cc
@@ -13,10 +13,19 @@
#include "build/build_config.h"
#include "media/base/media_switches.h"
-namespace media {
namespace {
static const size_t kDepthDeviceIndex = 1;
+static const char kDepthDeviceId[] = "/dev/video1";
+
+media::VideoPixelFormat GetPixelFormatFromDeviceId(
+ const std::string& device_id) {
+ return (device_id == kDepthDeviceId) ? media::PIXEL_FORMAT_Y16
+ : media::PIXEL_FORMAT_I420;
+}
+}
+
+namespace media {
// Cap the frame rate command line input to reasonable values.
static const float kFakeCaptureMinFrameRate = 5.0f;
@@ -26,17 +35,6 @@
// Cap the device count command line input to reasonable values.
static const int kFakeCaptureMinDeviceCount = 1;
static const int kFakeCaptureMaxDeviceCount = 10;
-
-FakeVideoCaptureDeviceMaker::PixelFormat GetPixelFormatFromDeviceId(
- const std::string& device_id) {
- if (device_id == "/dev/video1")
- return FakeVideoCaptureDeviceMaker::PixelFormat::Y16;
- if (device_id == "/dev/video2")
- return FakeVideoCaptureDeviceMaker::PixelFormat::MJPEG;
- return FakeVideoCaptureDeviceMaker::PixelFormat::I420;
-}
-
-} // anonymous namespace
FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory()
: number_of_devices_(1),
@@ -53,19 +51,8 @@
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) {
- FakeVideoCaptureDeviceMaker::PixelFormat pixel_format =
- GetPixelFormatFromDeviceId(possible_id);
- FakeVideoCaptureDeviceMaker::DeliveryMode delivery_mode = delivery_mode_;
- if (delivery_mode ==
- FakeVideoCaptureDeviceMaker::DeliveryMode::
- USE_CLIENT_PROVIDED_BUFFERS &&
- pixel_format == FakeVideoCaptureDeviceMaker::PixelFormat::MJPEG) {
- // Incompatible options. Fall back to using internal buffers.
- delivery_mode = FakeVideoCaptureDeviceMaker::DeliveryMode::
- USE_DEVICE_INTERNAL_BUFFERS;
- }
return FakeVideoCaptureDeviceMaker::MakeInstance(
- pixel_format, delivery_mode, frame_rate_);
+ GetPixelFormatFromDeviceId(possible_id), delivery_mode_, frame_rate_);
}
}
return std::unique_ptr<VideoCaptureDevice>();
@@ -113,8 +100,8 @@
ParseCommandLine();
- const VideoPixelFormat pixel_format = static_cast<VideoPixelFormat>(
- GetPixelFormatFromDeviceId(device_descriptor.device_id));
+ const VideoPixelFormat pixel_format =
+ GetPixelFormatFromDeviceId(device_descriptor.device_id);
const VideoPixelStorage pixel_storage = PIXEL_STORAGE_CPU;
std::vector<gfx::Size> supported_sizes;
FakeVideoCaptureDeviceMaker::GetSupportedSizes(&supported_sizes);
« 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