mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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,
|
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)));
|
||||||
}
|
}
|
||||||
|
|
@ -653,6 +656,19 @@ public final class MediaCodecInfo {
|
||||||
return capabilities.getMaxSupportedInstances();
|
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
|
* 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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue