| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/capture/video/fake_video_capture_device_factory.h" | 5 #include "device/capture/video/fake_video_capture_device_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace device { |
| 17 | 17 |
| 18 // Cap the frame rate command line input to reasonable values. | 18 // Cap the frame rate command line input to reasonable values. |
| 19 static const float kFakeCaptureMinFrameRate = 5.0f; | 19 static const float kFakeCaptureMinFrameRate = 5.0f; |
| 20 static const float kFakeCaptureMaxFrameRate = 60.0f; | 20 static const float kFakeCaptureMaxFrameRate = 60.0f; |
| 21 // Default rate if none is specified as part of the command line. | 21 // Default rate if none is specified as part of the command line. |
| 22 static const float kFakeCaptureDefaultFrameRate = 20.0f; | 22 static const float kFakeCaptureDefaultFrameRate = 20.0f; |
| 23 | 23 |
| 24 FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory() | 24 FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory() |
| 25 : number_of_devices_(1), | 25 : number_of_devices_(1), |
| 26 fake_vcd_ownership_(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS), | 26 fake_vcd_ownership_(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS), |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 double fps = 0; | 106 double fps = 0; |
| 107 if (base::StringToDouble(param.back(), &fps)) { | 107 if (base::StringToDouble(param.back(), &fps)) { |
| 108 frame_rate_ = | 108 frame_rate_ = |
| 109 std::max(kFakeCaptureMinFrameRate, static_cast<float>(fps)); | 109 std::max(kFakeCaptureMinFrameRate, static_cast<float>(fps)); |
| 110 frame_rate_ = std::min(kFakeCaptureMaxFrameRate, frame_rate_); | 110 frame_rate_ = std::min(kFakeCaptureMaxFrameRate, frame_rate_); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace media | 116 } // namespace device |
| OLD | NEW |