mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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
8709b1ef02
commit
1f265a4fac
1 changed files with 7 additions and 0 deletions
|
|
@ -145,6 +145,13 @@ public final class EncoderUtil {
|
||||||
return new Size(newWidth, newHeight);
|
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.
|
// Fix frame being too wide or too tall.
|
||||||
width = videoEncoderCapabilities.getSupportedWidths().clamp(width);
|
width = videoEncoderCapabilities.getSupportedWidths().clamp(width);
|
||||||
int adjustedHeight = videoEncoderCapabilities.getSupportedHeightsFor(width).clamp(height);
|
int adjustedHeight = videoEncoderCapabilities.getSupportedHeightsFor(width).clamp(height);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue