Loading media/codec2/sfplugin/utils/Codec2CommonUtils.cpp +21 −7 Original line number Diff line number Diff line Loading @@ -31,11 +31,19 @@ namespace android { bool isAtLeastT() { static bool isAtLeast(int version, const char *codeName) { char deviceCodeName[PROP_VALUE_MAX]; __system_property_get("ro.build.version.codename", deviceCodeName); return android_get_device_api_level() >= __ANDROID_API_T__ || !strcmp(deviceCodeName, "Tiramisu"); return android_get_device_api_level() >= version || !strcmp(deviceCodeName, codeName); } bool isAtLeastT() { return isAtLeast(__ANDROID_API_T__, "Tiramisu"); } bool isAtLeastU() { return isAtLeast(__ANDROID_API_U__, "UpsideDownCake"); } static bool isP010Allowed() { Loading Loading @@ -127,10 +135,16 @@ bool isHalPixelFormatSupported(AHardwareBuffer_Format format) { .rfu0 = 0, .rfu1 = 0, }; // Some devices running versions prior to Android U aren't guaranteed to advertise support // for some color formats when the consumer is an encoder. Hence limit these checks to // Android U and beyond. if (isAtLeastU()) { return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu) && AHardwareBuffer_isSupported(&consumableForHwEncoder) && AHardwareBuffer_isSupported(&consumableForSwEncoder); } else { return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu); } } } // namespace android media/codec2/sfplugin/utils/Codec2CommonUtils.h +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ namespace android { bool isAtLeastT(); bool isAtLeastU(); bool isVendorApiOrFirstApiAtLeastT(); /** Loading Loading
media/codec2/sfplugin/utils/Codec2CommonUtils.cpp +21 −7 Original line number Diff line number Diff line Loading @@ -31,11 +31,19 @@ namespace android { bool isAtLeastT() { static bool isAtLeast(int version, const char *codeName) { char deviceCodeName[PROP_VALUE_MAX]; __system_property_get("ro.build.version.codename", deviceCodeName); return android_get_device_api_level() >= __ANDROID_API_T__ || !strcmp(deviceCodeName, "Tiramisu"); return android_get_device_api_level() >= version || !strcmp(deviceCodeName, codeName); } bool isAtLeastT() { return isAtLeast(__ANDROID_API_T__, "Tiramisu"); } bool isAtLeastU() { return isAtLeast(__ANDROID_API_U__, "UpsideDownCake"); } static bool isP010Allowed() { Loading Loading @@ -127,10 +135,16 @@ bool isHalPixelFormatSupported(AHardwareBuffer_Format format) { .rfu0 = 0, .rfu1 = 0, }; // Some devices running versions prior to Android U aren't guaranteed to advertise support // for some color formats when the consumer is an encoder. Hence limit these checks to // Android U and beyond. if (isAtLeastU()) { return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu) && AHardwareBuffer_isSupported(&consumableForHwEncoder) && AHardwareBuffer_isSupported(&consumableForSwEncoder); } else { return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu); } } } // namespace android
media/codec2/sfplugin/utils/Codec2CommonUtils.h +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ namespace android { bool isAtLeastT(); bool isAtLeastU(); bool isVendorApiOrFirstApiAtLeastT(); /** Loading