| 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);
|
| }
|
| });
|
| }
|
|
|