Transformer: Add 8k disabling workaround to avoid timeouts.

PiperOrigin-RevId: 545970477
This commit is contained in:
huangdarwin 2023-07-06 14:37:45 +01:00 committed by Rohit Singh
parent bdbf3e29a1
commit 99a143a74e

View file

@ -132,6 +132,10 @@ public final class DefaultDecoderFactory implements Codec.DecoderFactory {
format, /* reason= */ "Decoding HDR is not supported on this device.");
}
}
if (deviceNeedsDisable8kWorkaround(format)) {
throw createExportException(
format, /* reason= */ "Decoding 8k is not supported on this device.");
}
MediaFormat mediaFormat = createMediaFormatFromFormat(format);
if (decoderSupportsKeyAllowFrameDrop) {
@ -173,6 +177,16 @@ public final class DefaultDecoderFactory implements Codec.DecoderFactory {
return Pair.create(mediaFormat, mediaCodecName);
}
private static boolean deviceNeedsDisable8kWorkaround(Format format) {
// Fixed on API 31+. See http://b/278234847#comment40 for more information.
return SDK_INT < 31
&& format.width >= 7680
&& format.height >= 4320
&& format.sampleMimeType != null
&& format.sampleMimeType.equals(MimeTypes.VIDEO_H265)
&& (Util.MODEL.equals("SM-F711U1") || Util.MODEL.equals("SM-F926U1"));
}
private static boolean deviceNeedsDisableToneMappingWorkaround(
@C.ColorTransfer int colorTransfer) {
if (Util.MANUFACTURER.equals("Google") && Build.ID.startsWith("TP1A")) {