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

Unified Diff: webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java

Issue 2021233002: Revert of Android: Change camera fps range selection (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « webrtc/androidjunit/src/org/webrtc/CameraEnumerationTest.java ('k') | webrtc/webrtc_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
diff --git a/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java b/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
index 87b9a40b628703369f4949aa2abc1bb0043423cd..2fa685d1fbceda2fbb9f7ceac4d2e2bb5bfdb251 100644
--- a/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
+++ b/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
@@ -181,37 +181,15 @@
}
}
- // Prefer a fps range with an upper bound close to |framerate|. Also prefer a fps range with a low
- // lower bound, to allow the framerate to fluctuate based on lightning conditions.
public static CaptureFormat.FramerateRange getClosestSupportedFramerateRange(
List<CaptureFormat.FramerateRange> supportedFramerates, final int requestedFps) {
return Collections.min(supportedFramerates,
new ClosestComparator<CaptureFormat.FramerateRange>() {
- // Progressive penalty if the upper bound is further away than |MAX_FPS_DIFF_THRESHOLD|
- // from requested.
- private static final int MAX_FPS_DIFF_THRESHOLD = 5000;
- private static final int MAX_FPS_LOW_DIFF_WEIGHT = 1;
- private static final int MAX_FPS_HIGH_DIFF_WEIGHT = 3;
-
- // Progressive penalty if the lower bound is bigger than |MIN_FPS_THRESHOLD|.
- private static final int MIN_FPS_THRESHOLD = 8000;
- private static final int MIN_FPS_LOW_VALUE_WEIGHT = 1;
- private static final int MIN_FPS_HIGH_VALUE_WEIGHT = 4;
-
- // Use one weight for small |value| less than |threshold|, and another weight above.
- private int progressivePenalty(int value, int threshold, int lowWeight, int highWeight) {
- return (value < threshold)
- ? value * lowWeight
- : threshold * lowWeight + (value - threshold) * highWeight;
- }
+ private static final int MAX_FPS_WEIGHT = 10;
@Override
int diff(CaptureFormat.FramerateRange range) {
- final int minFpsError = progressivePenalty(range.min,
- MIN_FPS_THRESHOLD, MIN_FPS_LOW_VALUE_WEIGHT, MIN_FPS_HIGH_VALUE_WEIGHT);
- final int maxFpsError = progressivePenalty(Math.abs(requestedFps * 1000 - range.max),
- MAX_FPS_DIFF_THRESHOLD, MAX_FPS_LOW_DIFF_WEIGHT, MAX_FPS_HIGH_DIFF_WEIGHT);
- return minFpsError + maxFpsError;
+ return range.min + MAX_FPS_WEIGHT * abs(requestedFps * 1000 - range.max);
}
});
}
« no previous file with comments | « webrtc/androidjunit/src/org/webrtc/CameraEnumerationTest.java ('k') | webrtc/webrtc_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698