Commit 6fe70ca4 by andrewlewis Committed by Oliver Woodman

Use the floor of the frame rate for capability checks

PiperOrigin-RevId: 255584000
parent ae0aeb04
...@@ -520,9 +520,15 @@ public final class MediaCodecInfo { ...@@ -520,9 +520,15 @@ public final class MediaCodecInfo {
@TargetApi(21) @TargetApi(21)
private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width, private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width,
int height, double frameRate) { int height, double frameRate) {
return frameRate == Format.NO_VALUE || frameRate <= 0 if (frameRate == Format.NO_VALUE || frameRate <= 0) {
? capabilities.isSizeSupported(width, height) return capabilities.isSizeSupported(width, height);
: capabilities.areSizeAndRateSupported(width, height, frameRate); } else {
// The signaled frame rate may be slightly higher than the actual frame rate, so we take the
// floor to avoid situations where a range check in areSizeAndRateSupported fails due to
// slightly exceeding the limits for a standard format (e.g., 1080p at 30 fps).
double floorFrameRate = Math.floor(frameRate);
return capabilities.areSizeAndRateSupported(width, height, floorFrameRate);
}
} }
@TargetApi(23) @TargetApi(23)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment