From c9dbd412bed00ecf1751c2768367f0d93fa56df6 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Fri, 17 Nov 2023 14:46:17 +0100 Subject: [PATCH] fix: Fix `VideoPipeline` crash because ProGuard removed `mHybridData` (#2169) --- .../src/main/java/com/mrousavy/camera/core/VideoPipeline.kt | 4 ++++ .../mrousavy/camera/frameprocessor/VisionCameraScheduler.java | 2 ++ 2 files changed, 6 insertions(+) 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 77440b7..0b2b69b 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 @@ -8,7 +8,9 @@ import android.media.ImageWriter import android.os.Build import android.util.Log import android.view.Surface +import androidx.annotation.Keep import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStrip import com.mrousavy.camera.frameprocessor.Frame import com.mrousavy.camera.frameprocessor.FrameProcessor import com.mrousavy.camera.types.Orientation @@ -51,6 +53,8 @@ class VideoPipeline( } } + @DoNotStrip + @Keep private val mHybridData: HybridData private var openGLTextureId: Int? = null private var transformMatrix = FloatArray(16) diff --git a/package/android/src/main/java/com/mrousavy/camera/frameprocessor/VisionCameraScheduler.java b/package/android/src/main/java/com/mrousavy/camera/frameprocessor/VisionCameraScheduler.java index 4dffad2..b437d6f 100644 --- a/package/android/src/main/java/com/mrousavy/camera/frameprocessor/VisionCameraScheduler.java +++ b/package/android/src/main/java/com/mrousavy/camera/frameprocessor/VisionCameraScheduler.java @@ -1,5 +1,6 @@ package com.mrousavy.camera.frameprocessor; +import androidx.annotation.Keep; import com.facebook.jni.HybridData; import com.facebook.proguard.annotations.DoNotStrip; import com.mrousavy.camera.core.CameraQueues; @@ -8,6 +9,7 @@ import com.mrousavy.camera.core.CameraQueues; public class VisionCameraScheduler { @SuppressWarnings({"unused", "FieldCanBeLocal"}) @DoNotStrip + @Keep private final HybridData mHybridData; public VisionCameraScheduler() {