fix: Fix "Invalid pixel format 35" HardwareBuffer crash (#2547)

This commit is contained in:
Marc Rousavy 2024-02-13 13:52:21 +01:00 committed by GitHub
parent 1011c3f039
commit a2a2e94865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -228,7 +228,11 @@ class VideoPipeline(
@RequiresApi(Build.VERSION_CODES.Q) @RequiresApi(Build.VERSION_CODES.Q)
private fun supportsHardwareBufferFlags(flags: Long): Boolean { private fun supportsHardwareBufferFlags(flags: Long): Boolean {
val hardwareBufferFormat = format.toHardwareBufferFormat() val hardwareBufferFormat = format.toHardwareBufferFormat()
return HardwareBuffer.isSupported(width, height, hardwareBufferFormat, 1, flags) try {
return HardwareBuffer.isSupported(width, height, hardwareBufferFormat, 1, flags)
} catch (_: Throwable) {
return false
}
} }
private external fun getInputTextureId(): Int private external fun getInputTextureId(): Int