| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_descriptor.h" | 5 #include "media/capture/video/video_capture_device_descriptor.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 capture_api(capture_api), | 38 capture_api(capture_api), |
| 39 transport_type(transport_type) {} | 39 transport_type(transport_type) {} |
| 40 | 40 |
| 41 VideoCaptureDeviceDescriptor::~VideoCaptureDeviceDescriptor() {} | 41 VideoCaptureDeviceDescriptor::~VideoCaptureDeviceDescriptor() {} |
| 42 | 42 |
| 43 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( | 43 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 44 const VideoCaptureDeviceDescriptor& other) = default; | 44 const VideoCaptureDeviceDescriptor& other) = default; |
| 45 | 45 |
| 46 bool VideoCaptureDeviceDescriptor::operator<( | 46 bool VideoCaptureDeviceDescriptor::operator<( |
| 47 const VideoCaptureDeviceDescriptor& other) const { | 47 const VideoCaptureDeviceDescriptor& other) const { |
| 48 static constexpr int kFacingMapping[NUM_MEDIA_VIDEO_FACING_MODE] = {0, 2, 1}; | 48 static constexpr int kFacingMapping[NUM_MEDIA_VIDEO_FACING_MODES] = {0, 2, 1}; |
| 49 static_assert(kFacingMapping[MEDIA_VIDEO_FACING_NONE] == 0, | 49 static_assert(kFacingMapping[MEDIA_VIDEO_FACING_NONE] == 0, |
| 50 "FACING_NONE has a wrong value"); | 50 "FACING_NONE has a wrong value"); |
| 51 static_assert(kFacingMapping[MEDIA_VIDEO_FACING_ENVIRONMENT] == 1, | 51 static_assert(kFacingMapping[MEDIA_VIDEO_FACING_ENVIRONMENT] == 1, |
| 52 "FACING_ENVIRONMENT has a wrong value"); | 52 "FACING_ENVIRONMENT has a wrong value"); |
| 53 static_assert(kFacingMapping[MEDIA_VIDEO_FACING_USER] == 2, | 53 static_assert(kFacingMapping[MEDIA_VIDEO_FACING_USER] == 2, |
| 54 "FACING_USER has a wrong value"); | 54 "FACING_USER has a wrong value"); |
| 55 if (kFacingMapping[facing] > kFacingMapping[other.facing]) | 55 if (kFacingMapping[facing] > kFacingMapping[other.facing]) |
| 56 return true; | 56 return true; |
| 57 if (device_id < other.device_id) | 57 if (device_id < other.device_id) |
| 58 return true; | 58 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { | 91 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { |
| 92 if (model_id.empty()) | 92 if (model_id.empty()) |
| 93 return display_name; | 93 return display_name; |
| 94 return display_name + " (" + model_id + ")"; | 94 return display_name + " (" + model_id + ")"; |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace media | 97 } // namespace media |
| OLD | NEW |