Skip tests if device needs disable 8k workaround

PiperOrigin-RevId: 549967326
This commit is contained in:
sheenachhabra 2023-07-21 17:24:07 +01:00 committed by Rohit Singh
parent b1cf5fb320
commit c2615a679f
2 changed files with 6 additions and 3 deletions

View file

@ -21,6 +21,7 @@ import static androidx.media3.common.MimeTypes.VIDEO_H264;
import static androidx.media3.common.MimeTypes.VIDEO_H265;
import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.common.util.Assertions.checkState;
import static androidx.media3.transformer.DefaultDecoderFactory.deviceNeedsDisableDecoding8kWorkaround;
import android.content.Context;
import android.graphics.Bitmap;
@ -853,7 +854,8 @@ public final class AndroidTestUtil {
MediaFormatUtil.maybeSetInteger(
mediaFormat, MediaFormat.KEY_PROFILE, codecProfileAndLevel.first);
}
return EncoderUtil.findCodecForFormat(mediaFormat, /* isDecoder= */ true) != null;
return EncoderUtil.findCodecForFormat(mediaFormat, /* isDecoder= */ true) != null
&& !deviceNeedsDisableDecoding8kWorkaround(format);
}
private static boolean canEncode(Format format) {

View file

@ -114,7 +114,7 @@ public final class DefaultDecoderFactory implements Codec.DecoderFactory {
format, /* reason= */ "Decoding HDR is not supported on this device.");
}
}
if (deviceNeedsDisable8kWorkaround(format)) {
if (deviceNeedsDisableDecoding8kWorkaround(format)) {
throw createExportException(
format, /* reason= */ "Decoding 8k is not supported on this device.");
}
@ -159,7 +159,8 @@ public final class DefaultDecoderFactory implements Codec.DecoderFactory {
context, format, mediaFormat, mediaCodecName, /* isDecoder= */ true, outputSurface);
}
private static boolean deviceNeedsDisable8kWorkaround(Format format) {
@VisibleForTesting
public static boolean deviceNeedsDisableDecoding8kWorkaround(Format format) {
// Fixed on API 31+. See http://b/278234847#comment40 for more information.
return SDK_INT < 31
&& format.width >= 7680