From a2a2e94865fa8fdf7e140cd15358f4c6cbe31e72 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 13 Feb 2024 13:52:21 +0100 Subject: [PATCH] fix: Fix "Invalid pixel format 35" HardwareBuffer crash (#2547) --- .../src/main/java/com/mrousavy/camera/core/VideoPipeline.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/android/src/main/java/com/mrousavy/camera/core/VideoPipeline.kt b/package/android/src/main/java/com/mrousavy/camera/core/VideoPipeline.kt index f864642..99374cc 100644 --- a/package/android/src/main/java/com/mrousavy/camera/core/VideoPipeline.kt +++ b/package/android/src/main/java/com/mrousavy/camera/core/VideoPipeline.kt @@ -228,7 +228,11 @@ class VideoPipeline( @RequiresApi(Build.VERSION_CODES.Q) private fun supportsHardwareBufferFlags(flags: Long): Boolean { 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