Chromium Code Reviews| Index: media/capture/video/video_capture_device_descriptor.cc |
| diff --git a/media/capture/video/video_capture_device_descriptor.cc b/media/capture/video/video_capture_device_descriptor.cc |
| index f1e288cbe32954ee07a9a6de78c723e2a37b3bb2..51aa3f02e7e1bb83a0f41863cf10f3e10d81a530 100644 |
| --- a/media/capture/video/video_capture_device_descriptor.cc |
| +++ b/media/capture/video/video_capture_device_descriptor.cc |
| @@ -4,6 +4,8 @@ |
| #include "media/capture/video/video_capture_device_descriptor.h" |
| +#include <map> |
| + |
| #include "base/logging.h" |
| namespace media { |
| @@ -43,6 +45,19 @@ VideoCaptureDeviceDescriptor::~VideoCaptureDeviceDescriptor() {} |
| VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| const VideoCaptureDeviceDescriptor& other) = default; |
| +bool VideoCaptureDeviceDescriptor::operator<( |
| + const VideoCaptureDeviceDescriptor& other) const { |
| + std::map<media::VideoFacingMode, size_t> facing_mapping{ |
|
Guido Urdaneta
2017/01/24 10:42:07
nit: Optional. the map is fine, but maybe you can
henryhsu
2017/01/25 03:28:18
Done.
|
| + {MEDIA_VIDEO_FACING_USER, 0}, |
| + {MEDIA_VIDEO_FACING_ENVIRONMENT, 1}, |
| + {MEDIA_VIDEO_FACING_NONE, 2}}; |
| + if (facing_mapping.at(facing) < facing_mapping.at(other.facing)) |
| + return true; |
| + if (device_id < other.device_id) |
| + return true; |
| + return capture_api < other.capture_api; |
| +} |
| + |
| const char* VideoCaptureDeviceDescriptor::GetCaptureApiTypeString() const { |
| switch (capture_api) { |
| case VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE: |