mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Move another adaptation workaround into MediaCodecInfo
PiperOrigin-RevId: 340654217
This commit is contained in:
parent
effbc22a62
commit
773e890768
2 changed files with 19 additions and 17 deletions
|
|
@ -179,7 +179,10 @@ public final class MediaCodecInfo {
|
|||
hardwareAccelerated,
|
||||
softwareOnly,
|
||||
vendor,
|
||||
/* adaptive= */ !forceDisableAdaptive && capabilities != null && isAdaptive(capabilities),
|
||||
/* adaptive= */ !forceDisableAdaptive
|
||||
&& capabilities != null
|
||||
&& isAdaptive(capabilities)
|
||||
&& !needsDisableAdaptationWorkaround(name),
|
||||
/* tunneling= */ capabilities != null && isTunneling(capabilities),
|
||||
/* secure= */ forceSecure || (capabilities != null && isSecure(capabilities)));
|
||||
}
|
||||
|
|
@ -653,6 +656,19 @@ public final class MediaCodecInfo {
|
|||
return capabilities.getMaxSupportedInstances();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* new format's configuration data.
|
||||
|
|
|
|||
|
|
@ -312,7 +312,6 @@ public final class MediaCodecUtil {
|
|||
boolean hardwareAccelerated = isHardwareAccelerated(codecInfo);
|
||||
boolean softwareOnly = isSoftwareOnly(codecInfo);
|
||||
boolean vendor = isVendor(codecInfo);
|
||||
boolean forceDisableAdaptive = codecNeedsDisableAdaptationWorkaround(name);
|
||||
if ((secureDecodersExplicit && key.secure == secureSupported)
|
||||
|| (!secureDecodersExplicit && !key.secure)) {
|
||||
decoderInfos.add(
|
||||
|
|
@ -324,7 +323,7 @@ public final class MediaCodecUtil {
|
|||
hardwareAccelerated,
|
||||
softwareOnly,
|
||||
vendor,
|
||||
forceDisableAdaptive,
|
||||
/* forceDisableAdaptive= */ false,
|
||||
/* forceSecure= */ false));
|
||||
} else if (!secureDecodersExplicit && secureSupported) {
|
||||
decoderInfos.add(
|
||||
|
|
@ -336,7 +335,7 @@ public final class MediaCodecUtil {
|
|||
hardwareAccelerated,
|
||||
softwareOnly,
|
||||
vendor,
|
||||
forceDisableAdaptive,
|
||||
/* forceDisableAdaptive= */ false,
|
||||
/* forceSecure= */ true));
|
||||
// It only makes sense to have one synthesized secure decoder, return immediately.
|
||||
return decoderInfos;
|
||||
|
|
@ -651,19 +650,6 @@ public final class MediaCodecUtil {
|
|||
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
|
||||
private static Pair<Integer, Integer> getDolbyVisionProfileAndLevel(
|
||||
String codec, String[] parts) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue