Add trying 1/3 resolution in fallback.
1/4 is probably unnecessary, as 1/3 of 4k is 720, which should be supported on all practical encoders. PiperOrigin-RevId: 440055144
This commit is contained in:
parent
a2d92ec623
commit
7d0034748f
@ -147,6 +147,13 @@ public final class EncoderUtil {
|
||||
return new Size(newWidth, newHeight);
|
||||
}
|
||||
|
||||
// Try one-third (e.g. 4k -> 720).
|
||||
newWidth = alignResolution(width / 3, widthAlignment);
|
||||
newHeight = alignResolution(height / 3, heightAlignment);
|
||||
if (videoEncoderCapabilities.isSizeSupported(newWidth, newHeight)) {
|
||||
return new Size(newWidth, newHeight);
|
||||
}
|
||||
|
||||
// Fix frame being too wide or too tall.
|
||||
width = videoEncoderCapabilities.getSupportedWidths().clamp(width);
|
||||
int adjustedHeight = videoEncoderCapabilities.getSupportedHeightsFor(width).clamp(height);
|
||||
|
Loading…
x
Reference in New Issue
Block a user