OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/video_capture_device.h" | 5 #include "media/capture/video/video_capture_device.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "base/i18n/timezone.h" | 8 #include "base/i18n/timezone.h" |
8 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "media/base/media_switches.h" |
9 | 11 |
10 namespace media { | 12 namespace media { |
11 | 13 |
| 14 // TODO(msu.koo): http://crbug.com/532272, remove checking the switch in favour |
| 15 // of deferring GetModel() call to the actual VideoCaptureDevice object. |
12 const std::string VideoCaptureDevice::Name::GetNameAndModel() const { | 16 const std::string VideoCaptureDevice::Name::GetNameAndModel() const { |
13 const std::string model_id = GetModel(); | 17 const std::string model_id = GetModel(); |
14 if (model_id.empty()) | 18 if (model_id.empty()) |
15 return device_name_; | 19 return device_name_; |
16 const std::string suffix = " (" + model_id + ")"; | 20 const std::string suffix = " (" + model_id + ")"; |
17 if (base::EndsWith(device_name_, suffix, base::CompareCase::SENSITIVE)) | 21 if (base::EndsWith(device_name_, suffix, base::CompareCase::SENSITIVE) || |
| 22 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 23 switches::kUseFakeDeviceForMediaStream)) |
| 24 // Ignore |model_id| if |kUseFakeDeviceForMediaStream| flag is present. |
18 return device_name_; | 25 return device_name_; |
19 return device_name_ + suffix; | 26 return device_name_ + suffix; |
20 } | 27 } |
21 | 28 |
22 VideoCaptureDevice::Name::Name() { | 29 VideoCaptureDevice::Name::Name() { |
23 } | 30 } |
24 | 31 |
25 VideoCaptureDevice::Name::Name(const std::string& name, const std::string& id) | 32 VideoCaptureDevice::Name::Name(const std::string& name, const std::string& id) |
26 : device_name_(name), unique_id_(id) { | 33 : device_name_(name), unique_id_(id) { |
27 } | 34 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 switch (params.power_line_frequency) { | 170 switch (params.power_line_frequency) { |
164 case media::PowerLineFrequency::FREQUENCY_50HZ: // fall through | 171 case media::PowerLineFrequency::FREQUENCY_50HZ: // fall through |
165 case media::PowerLineFrequency::FREQUENCY_60HZ: | 172 case media::PowerLineFrequency::FREQUENCY_60HZ: |
166 return static_cast<int>(params.power_line_frequency); | 173 return static_cast<int>(params.power_line_frequency); |
167 default: | 174 default: |
168 return GetPowerLineFrequencyForLocation(); | 175 return GetPowerLineFrequencyForLocation(); |
169 } | 176 } |
170 } | 177 } |
171 | 178 |
172 } // namespace media | 179 } // namespace media |
OLD | NEW |