OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/video/capture/win/capability_list_win.h" | 5 #include "media/video/capture/win/capability_list_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 return diff_width_lhs < diff_width_rhs; | 32 return diff_width_lhs < diff_width_rhs; |
33 | 33 |
34 const float diff_fps_lhs = std::fabs(lhs.frame_rate - requested.frame_rate); | 34 const float diff_fps_lhs = std::fabs(lhs.frame_rate - requested.frame_rate); |
35 const float diff_fps_rhs = std::fabs(rhs.frame_rate - requested.frame_rate); | 35 const float diff_fps_rhs = std::fabs(rhs.frame_rate - requested.frame_rate); |
36 if (diff_fps_lhs != diff_fps_rhs) | 36 if (diff_fps_lhs != diff_fps_rhs) |
37 return diff_fps_lhs < diff_fps_rhs; | 37 return diff_fps_lhs < diff_fps_rhs; |
38 | 38 |
39 return lhs.pixel_format < rhs.pixel_format; | 39 return lhs.pixel_format < rhs.pixel_format; |
40 } | 40 } |
41 | 41 |
42 CapabilityWin GetBestMatchedCapability(const VideoCaptureFormat& requested, | 42 const CapabilityWin& GetBestMatchedCapability( |
43 const CapabilityList& capabilities) { | 43 const VideoCaptureFormat& requested, |
| 44 const CapabilityList& capabilities) { |
44 DCHECK(!capabilities.empty()); | 45 DCHECK(!capabilities.empty()); |
45 CapabilityWin best_match = capabilities.front(); | 46 const CapabilityWin* best_match = &(*capabilities.begin()); |
46 for (const CapabilityWin& capability : capabilities) { | 47 for (const CapabilityWin& capability : capabilities) { |
47 if (CompareCapability(requested, capability, best_match)) | 48 if (CompareCapability(requested, capability, *best_match)) |
48 best_match = capability; | 49 best_match = &capability; |
49 } | 50 } |
50 return best_match; | 51 return *best_match; |
51 } | 52 } |
52 | 53 |
53 } // namespace media | 54 } // namespace media |
OLD | NEW |