Commit 773e8907 by olly Committed by Andrew Lewis

Move another adaptation workaround into MediaCodecInfo

PiperOrigin-RevId: 340654217
parent effbc22a
...@@ -179,7 +179,10 @@ public final class MediaCodecInfo { ...@@ -179,7 +179,10 @@ public final class MediaCodecInfo {
hardwareAccelerated, hardwareAccelerated,
softwareOnly, softwareOnly,
vendor, vendor,
/* adaptive= */ !forceDisableAdaptive && capabilities != null && isAdaptive(capabilities), /* adaptive= */ !forceDisableAdaptive
&& capabilities != null
&& isAdaptive(capabilities)
&& !needsDisableAdaptationWorkaround(name),
/* tunneling= */ capabilities != null && isTunneling(capabilities), /* tunneling= */ capabilities != null && isTunneling(capabilities),
/* secure= */ forceSecure || (capabilities != null && isSecure(capabilities))); /* secure= */ forceSecure || (capabilities != null && isSecure(capabilities)));
} }
...@@ -654,6 +657,19 @@ public final class MediaCodecInfo { ...@@ -654,6 +657,19 @@ public final class MediaCodecInfo {
} }
/** /**
* Returns whether the decoder is known to fail when adapting, despite advertising itself as an
* adaptive decoder.
*
* @param name The decoder name.
* @return True if the decoder is known to fail when adapting.
*/
private static boolean needsDisableAdaptationWorkaround(String name) {
return Util.SDK_INT <= 22
&& ("ODROID-XU3".equals(Util.MODEL) || "Nexus 10".equals(Util.MODEL))
&& ("OMX.Exynos.AVC.Decoder".equals(name) || "OMX.Exynos.AVC.Decoder.secure".equals(name));
}
/**
* Returns whether the decoder is known to fail when an attempt is made to reconfigure it with a * Returns whether the decoder is known to fail when an attempt is made to reconfigure it with a
* new format's configuration data. * new format's configuration data.
* *
......
...@@ -312,7 +312,6 @@ public final class MediaCodecUtil { ...@@ -312,7 +312,6 @@ public final class MediaCodecUtil {
boolean hardwareAccelerated = isHardwareAccelerated(codecInfo); boolean hardwareAccelerated = isHardwareAccelerated(codecInfo);
boolean softwareOnly = isSoftwareOnly(codecInfo); boolean softwareOnly = isSoftwareOnly(codecInfo);
boolean vendor = isVendor(codecInfo); boolean vendor = isVendor(codecInfo);
boolean forceDisableAdaptive = codecNeedsDisableAdaptationWorkaround(name);
if ((secureDecodersExplicit && key.secure == secureSupported) if ((secureDecodersExplicit && key.secure == secureSupported)
|| (!secureDecodersExplicit && !key.secure)) { || (!secureDecodersExplicit && !key.secure)) {
decoderInfos.add( decoderInfos.add(
...@@ -324,7 +323,7 @@ public final class MediaCodecUtil { ...@@ -324,7 +323,7 @@ public final class MediaCodecUtil {
hardwareAccelerated, hardwareAccelerated,
softwareOnly, softwareOnly,
vendor, vendor,
forceDisableAdaptive, /* forceDisableAdaptive= */ false,
/* forceSecure= */ false)); /* forceSecure= */ false));
} else if (!secureDecodersExplicit && secureSupported) { } else if (!secureDecodersExplicit && secureSupported) {
decoderInfos.add( decoderInfos.add(
...@@ -336,7 +335,7 @@ public final class MediaCodecUtil { ...@@ -336,7 +335,7 @@ public final class MediaCodecUtil {
hardwareAccelerated, hardwareAccelerated,
softwareOnly, softwareOnly,
vendor, vendor,
forceDisableAdaptive, /* forceDisableAdaptive= */ false,
/* forceSecure= */ true)); /* forceSecure= */ true));
// It only makes sense to have one synthesized secure decoder, return immediately. // It only makes sense to have one synthesized secure decoder, return immediately.
return decoderInfos; return decoderInfos;
...@@ -651,19 +650,6 @@ public final class MediaCodecUtil { ...@@ -651,19 +650,6 @@ public final class MediaCodecUtil {
return codecInfo.isVendor(); return codecInfo.isVendor();
} }
/**
* Returns whether the decoder is known to fail when adapting, despite advertising itself as an
* adaptive decoder.
*
* @param name The decoder name.
* @return True if the decoder is known to fail when adapting.
*/
private static boolean codecNeedsDisableAdaptationWorkaround(String name) {
return Util.SDK_INT <= 22
&& ("ODROID-XU3".equals(Util.MODEL) || "Nexus 10".equals(Util.MODEL))
&& ("OMX.Exynos.AVC.Decoder".equals(name) || "OMX.Exynos.AVC.Decoder.secure".equals(name));
}
@Nullable @Nullable
private static Pair<Integer, Integer> getDolbyVisionProfileAndLevel( private static Pair<Integer, Integer> getDolbyVisionProfileAndLevel(
String codec, String[] parts) { String codec, String[] parts) {
......
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