Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Side by Side Diff: media/video/capture/win/capability_list_win.cc

Issue 913183006: Use BITMAPINFOHEADER from capture capability enumeration when using MJPG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed a nit. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « media/video/capture/win/capability_list_win.h ('k') | media/video/capture/win/sink_filter_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698