Commit 2e3ffe1e by olly Committed by Oliver Woodman

Assume support for vertical video if rotated resolution supported

Issue: #2034

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140209306
parent ee9b7be2
......@@ -153,8 +153,14 @@ public final class MediaCodecInfo {
return false;
}
if (!videoCapabilities.isSizeSupported(width, height)) {
logNoSupport("size.support, " + width + "x" + height);
return false;
// Capabilities are known to be inaccurately reported for vertical resolutions on some devices
// (b/31387661). If the video is vertical and the capabilities indicate support if the width
// and height are swapped, we assume that the vertical resolution is also supported.
if (width >= height || !videoCapabilities.isSizeSupported(height, width)) {
logNoSupport("size.support, " + width + "x" + height);
return false;
}
logAssumedSupport("size.rotated, " + width + "x" + height);
}
return true;
}
......@@ -181,8 +187,14 @@ public final class MediaCodecInfo {
return false;
}
if (!videoCapabilities.areSizeAndRateSupported(width, height, frameRate)) {
logNoSupport("sizeAndRate.support, " + width + "x" + height + "x" + frameRate);
return false;
// Capabilities are known to be inaccurately reported for vertical resolutions on some devices
// (b/31387661). If the video is vertical and the capabilities indicate support if the width
// and height are swapped, we assume that the vertical resolution is also supported.
if (width >= height || !videoCapabilities.areSizeAndRateSupported(height, width, frameRate)) {
logNoSupport("sizeAndRate.support, " + width + "x" + height + "x" + frameRate);
return false;
}
logAssumedSupport("sizeAndRate.rotated, " + width + "x" + height + "x" + frameRate);
}
return true;
}
......@@ -240,7 +252,12 @@ public final class MediaCodecInfo {
}
private void logNoSupport(String message) {
Log.d(TAG, "FalseCheck [" + message + "] [" + name + ", " + mimeType + "] ["
Log.d(TAG, "NoSupport [" + message + "] [" + name + ", " + mimeType + "] ["
+ Util.DEVICE_DEBUG_INFO + "]");
}
private void logAssumedSupport(String message) {
Log.d(TAG, "AssumedSupport [" + message + "] [" + name + ", " + mimeType + "] ["
+ Util.DEVICE_DEBUG_INFO + "]");
}
......
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