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

Unified Diff: media/video/capture/video_capture_types.cc

Issue 558623002: Video capture: Refactor GetBestMatchedFormat from Win to OS independent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change diff type from int to float Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/video_capture_types.cc
diff --git a/media/video/capture/video_capture_types.cc b/media/video/capture/video_capture_types.cc
index ce5c354e290eed22fef06f69a067b4cf2d01265c..1b1fdd54ea785e040e077d9d0dcb1ae5908adc56 100644
--- a/media/video/capture/video_capture_types.cc
+++ b/media/video/capture/video_capture_types.cc
@@ -4,6 +4,8 @@
#include "media/video/capture/video_capture_types.h"
+#include <cmath>
+
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "media/base/limits.h"
@@ -69,4 +71,11 @@ std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) {
VideoCaptureParams::VideoCaptureParams()
: resolution_change_policy(RESOLUTION_POLICY_FIXED) {}
+
+float DiffVideoCaptureFormat(const VideoCaptureFormat& lhs,
+ const VideoCaptureFormat& rhs) {
+ return std::abs(lhs.frame_size.width() - rhs.frame_size.width()) +
+ std::abs(lhs.frame_size.height() - rhs.frame_size.height()) +
+ std::fabs(lhs.frame_rate - rhs.frame_rate);
+}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698