mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.57k stars 1.1k forks source link

🐛 My app closes automatically after a while of processing frames #3247

Open kHanHnq4901 opened 1 month ago

kHanHnq4901 commented 1 month ago

What's happening?

Ảnh màn hình 2024-10-16 lúc 14 20 07

Reproduceable Code

36.989  9496-9595  com.meterwater          com.meterwater                       A  java_vm_ext.cc:710] JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump:
                                                                                                    java_vm_ext.cc:710]   Last 10 entries (of 51200):
                                                                                                    java_vm_ext.cc:710]     51199: 0x173080d8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51198: 0x173080d8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51197: 0x17306f18 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51196: 0x172a5ce8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51195: 0x172a4b28 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51194: 0x172a3960 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51193: 0x172a2798 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51192: 0x172a15d8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51191: 0x172a0418 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51190: 0x1729f258 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]   Summary:
                                                                                                    java_vm_ext.cc:710]     50586 of com.mrousavy.camera.frameprocessors.Frame (50585 unique instances)
                                                                                                    java_vm_ext.cc:710]       453 of java.lang.Class (337 unique instances)
                                                                                                    java_vm_ext.cc:710]        58 of com.facebook.react.bridge.JavaModuleWrapper (58 unique instances)
                                                                                                    java_vm_ext.cc:710]        13 of java.lang.ref.WeakReference (13 unique instances)
                                                                                                    java_vm_ext.cc:710]         5 of com.facebook.react.bridge.ReadableType (5 unique instances)
                                                                                                    java_vm_ext.cc:710]         5 of android.view.ViewRootImpl$W (5 unique instances)
                                                                                                    java_vm_ext.cc:710]         4 of android.content.ContentProvider$Transport (4 unique instances)
                                                                                                    java_vm_ext.cc:710]         3 of java.lang.String (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         3 of dalvik.system.PathClassLoader (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.mrousavy.camera.frameprocessors.VisionCameraProxy (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.mrousavy.camera.frameprocessors.VisionCameraScheduler (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.swmansion.reanimated.AndroidUIScheduler (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.swmansion.reanimated.layoutReanimation.LayoutAnimations (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.hardware.camera2.CameraManager$CameraManagerGlobal (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.view.ThreadedRenderer$WebViewOverlayProvider (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.facebook.react.bridge.queue.MessageQueueThreadImpl (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of float[] (16 elements) (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of int[] (16 elements) (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of java.lang.ThreadGroup (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.opengl.EGLContext (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.opengl.EGLDisplay (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.opengl.EGLSurface (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.bridge.RuntimeScheduler
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.bridge.RuntimeExecutor
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.modules.blob.BlobModule
                                                                                                    java_vm_ext.cc:710]         1 of com.swmansion.rnscreens.ScreensModule
                                                                                                    java_vm_ext.cc:710]         1 of com.reactlibrary.RNOpenCvLibraryModule
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.network.NetworkFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin
2024-10-16 14:19:36.989  9496-9595  com.meterwater          com.meterwater                       A  java_vm_ext.cc:710]         1 of com.facebook.flipper.android.FlipperClientImpl
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.bridge.Inspector
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.bridge.CatalystInstanceImpl$BridgeCallback
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.turbomodule.core.CallInvokerHolderImpl
                                                                                                    java_vm_ext.cc:710]         1 of com.swmansion.reanimated.NativeProxy
                                                                                                    java_vm_ext.cc:710]         1 of com.shopify.reactnative.skia.SkiaManager
                                                                                                    java_vm_ext.cc:710]         1 of com.shopify.reactnative.skia.PlatformContext
                                                                                                    java_vm_ext.cc:710]         1 of com.swmansion.reanimated.ReanimatedMessageQueueThread
                                                                                                    java_vm_ext.cc:710]         1 of android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks
                                                                                                    java_vm_ext.cc:710]         1 of dalvik.system.VMRuntime
                                                                                                    java_vm_ext.cc:710]         1 of android.os.ResultReceiver$MyResultReceiver
                                                                                                    java_vm_ext.cc:710]         1 of android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper
                                                                                                    java_vm_ext.cc:710]         1 of android.os.Binder
                                                                                                    java_vm_ext.cc:710]         1 of android.os.Handler$MessengerImpl
                                                                                                    java_vm_ext.cc:710]         1 of java.nio.DirectByteBuffer
                                                                                                    java_vm_ext.cc:710]         1 of java.nio.ByteOrder
                                                                                                    java_vm_ext.cc:710]         1 of android.graphics.SurfaceTexture
                                                                                                    java_vm_ext.cc:710]         1 of android.hardware.camera2.impl.CameraDeviceImpl
                                                                                                    java_vm_ext.cc:710]         1 of android.app.ActivityThread$3
                                                                                                    java_vm_ext.cc:710]         1 of android.app.UiModeManager$Globals
                                                                                                    java_vm_ext.cc:710]         1 of android.graphics.HardwareRenderer$ProcessInitializer$1
                                                                                                    java_vm_ext.cc:710]         1 of android.hardware.devicestate.DeviceStateManagerGlobal$DeviceStateManagerCallback
                                                                                                    java_vm_ext.cc:710]         1 of android.os.PersistableBundle$1
                                                                                                    java_vm_ext.cc:710]         1 of android.view.ViewRootImpl$1
                                                                                                    java_vm_ext.cc:710]         1 of android.view.WindowManagerGlobal$1
                                                                                                    java_vm_ext.cc:710]         1 of android.view.accessibility.AccessibilityManager$1
                                                                                                    java_vm_ext.cc:710]         1 of android.view.inputmethod.InputMethodManager$2
                                                                                                    java_vm_ext.cc:710]         1 of android.view.inputmethod.RemoteInputConnectionImpl
                                                                                                    java_vm_ext.cc:710]         1 of android.view.textservice.SpellCheckerSession$SpellCheckerSessionListenerImpl
                                                                                                    java_vm_ext.cc:710]         1 of android.app.ActivityThread$ApplicationThread
                                                                                                    java_vm_ext.cc:710]         1 of android.hardware.display.DisplayManagerGlobal$DisplayManagerCallback
                                                                                                    java_vm_ext.cc:710]         1 of android.database.ContentObserver$Transport
                                                                                                    java_vm_ext.cc:710]         1 of android.app.LoadedApk$ReceiverDispatcher$InnerReceiver
                                                                                                    java_vm_ext.cc:710] 
2024-10-16 14:19:37.419  9496-9595  com.meterwater          com.meterwater                       A  runtime.cc:708] Runtime aborting...
                                                                                                    runtime.cc:708] All threads:
                                                                                                    runtime.cc:708] DALVIK THREADS (55):
                                                                                                    runtime.cc:708] "main" prio=7 tid=1 Native
                                                                                                    runtime.cc:708]   | group="" sCount=1 ucsCount=0 flags=1 obj=0x722818d8 self=0xb400007544e2e380
                                                                                                    runtime.cc:708]   | sysTid=9496 nice=-4 cgrp=top-app sched=0/0 handle=0x763a78dd20
                                                                                                    runtime.cc:708]   | state=S schedstat=( 201500995439 19706915689 390069 ) utm=6330 stm=13820 core=0 HZ=100
                                                                                                    runtime.cc:708]   | stack=0x7fc8afe000-0x7fc8b00000 stackSize=8188KB
                                                                                                    runtime.cc:708]   | held mutexes=
                                                                                                    runtime.cc:708]   native: #00 pc 0008129c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) (BuildId: 86ef66da58f6886dfa74a7bbf8cca652)
                                                                                                    runtime.cc:708]   native: #01 pc 003750b4  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks+140) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #02 pc 004e87b0  /apex/com.android.art/lib64/libart.so (art::::CheckJNI::CallMethodV +2876) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #03 pc 006d0e8c  /apex/com.android.art/lib64/libart.so (art::::CheckJNI::CallObjectMethodV +72) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #04 pc 000d7220  /system/lib64/libandroid_runtime.so (_JNIEnv::CallObjectMethod+120) (BuildId: aefe59c59fae44bfb24352091b456cb2)
                                                                                                    runtime.cc:708]   native: #05 pc 00150618  /system/lib64/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync+64) (BuildId: aefe59c59fae44bfb24352091b456cb2)
                                                                                                    runtime.cc:708]   native: #06 pc 000d7d54  /system/lib64/libgui.so (android::DisplayEventDispatcher::handleEvent+400) (BuildId: 2cdee0b40cca837ccf9850823034f65f)
                                                                                                    runtime.cc:708]   native: #07 pc 00013a30  /system/lib64/libutils.so (android::Looper::pollOnce+428) (BuildId: 5400ad7d249254daf673dc308737a918)
                                                                                                    runtime.cc:708]   native: #08 pc 001808a8  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce+44) (BuildId: aefe59c59fae44bfb24352091b456cb2)
                                                                                                    runtime.cc:708]   native: #09 pc 003c630c  [anon_shmem:dalvik-jit-code-cache] (offset 2000000) (art_jni_trampoline+140)
                                                                                                    runtime.cc:708]   native: #10 pc 0008ac00  [anon_shmem:dalvik-jit-code-cache] (offset 2000000) (android.os.MessageQueue.next+320)
                                                                                                    runtime.cc:708]   native: #11 pc 00089de4  [anon_shmem:dalvik-jit-code-cache] (offset 2000000) (android.os.Looper.loopOnce+164)
                                                                                                    runtime.cc:708]   native: #12 pc 001ad37c  [anon_shmem:dalvik-jit-code-cache] (offset 2000000) (android.os.Looper.loop+300)
                                                                                                    runtime.cc:708]   native: #13 pc 003ae8d0  /apex/com.android.art/lib64/libart.so (art_quick_osr_stub+64) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #14 pc 00373588  /apex/com.android.art/lib64/libart.so (art::jit::Jit::MaybeDoOnStackReplacement+476) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #15 pc 0052fb40  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+9804) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #16 pc 003c73d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #17 pc 001fc6ac  /system/framework/framework.jar (android.os.Looper.loop)
                                                                                                    runtime.cc:708]   native: #18 pc 004ee9ec  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +324) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #19 pc 0052c734  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+4224) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #20 pc 00530a28  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+13620) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #21 pc 003c73d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
2024-10-16 14:19:37.419  9496-9595  com.meterwater          com.meterwater                       A  runtime.cc:708]   native: #22 pc 001d1d28  /system/framework/framework.jar (android.app.ActivityThread.main)
                                                                                                    runtime.cc:708]   native: #23 pc 0039c030  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1296) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #24 pc 003c4e98  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #25 pc 003ae840  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #26 pc 003c9068  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<8>+840) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #27 pc 003c8d10  /apex/com.android.art/lib64/libart.so (art::Method_invoke +32) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #28 pc 003c4d70  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #29 pc 003ae574  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #30 pc 0052baa0  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+1004) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #31 pc 00530a28  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+13620) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #32 pc 003c73d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #33 pc 000d6a08  /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run)
                                                                                                    runtime.cc:708]   native: #34 pc 0039c030  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1296) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #35 pc 003c4e98  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #36 pc 0073d314  /apex/com.android.art/lib64/libart.so (nterp_helper+7636) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #37 pc 000db1f6  /system/framework/framework.jar (com.android.internal.os.ZygoteInit.main+598)
                                                                                                    runtime.cc:708]   native: #38 pc 003ae840  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #39 pc 003df7d0  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke+220) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #40 pc 005cf5ac  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>+316) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #41 pc 00701b48  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV+112) (BuildId: 695f1c07c7c56b777bf798161a0a44d8)
                                                                                                    runtime.cc:708]   native: #42 pc 000d91b8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod+104) (BuildId: aefe59c59fae44bfb24352091b456cb2)
                                                                                                    runtime.cc:708]   native: #43 pc 000eeac0  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start+844) (BuildId: aefe59c59fae44bfb24352091b456cb2)
                                                                                                    runtime.cc:708]   native: #44 pc 00004580  /system/bin/app_process64 (main+1224) (BuildId: e6cba435f7d7c382f875f8b9e8ac06d2)
                                                                                                    runtime.cc:708]   native: #45 pc 0005506c  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+116) (BuildId: 86ef66da58f6886dfa74a7bbf8cca652)
                                                                                                    runtime.cc:708]   at android.os.MessageQueue.nativePollOnce(Native method)
                                                                                                    runtime.cc:708]   at android.os.MessageQueue.next(MessageQueue.java:346)
                                                                                                    runtime.cc:708]   at android.os.Looper.loopOnce(Looper.java:189)
                                                                                                    runtime.cc:708]   at android.os.Looper.loop(Looper.java:317)
2024-10-16 14:19:37.419  9496-9595  com.meterwater          com.meterwater                       A  runtime.cc:708]   at android.app.ActivityThread.main(ActivityThread.java:8674)
                                                                                                    runtime.cc:708]   at java.lang.reflect.Method.invoke(Native method)
                                                                                                    runtime.cc:708]   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)

Relevant log output

36.989  9496-9595  com.meterwater          com.meterwater                       A  java_vm_ext.cc:710] JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump:
                                                                                                    java_vm_ext.cc:710]   Last 10 entries (of 51200):
                                                                                                    java_vm_ext.cc:710]     51199: 0x173080d8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51198: 0x173080d8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51197: 0x17306f18 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51196: 0x172a5ce8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51195: 0x172a4b28 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51194: 0x172a3960 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51193: 0x172a2798 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51192: 0x172a15d8 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51191: 0x172a0418 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]     51190: 0x1729f258 com.mrousavy.camera.frameprocessors.Frame
                                                                                                    java_vm_ext.cc:710]   Summary:
                                                                                                    java_vm_ext.cc:710]     50586 of com.mrousavy.camera.frameprocessors.Frame (50585 unique instances)
                                                                                                    java_vm_ext.cc:710]       453 of java.lang.Class (337 unique instances)
                                                                                                    java_vm_ext.cc:710]        58 of com.facebook.react.bridge.JavaModuleWrapper (58 unique instances)
                                                                                                    java_vm_ext.cc:710]        13 of java.lang.ref.WeakReference (13 unique instances)
                                                                                                    java_vm_ext.cc:710]         5 of com.facebook.react.bridge.ReadableType (5 unique instances)
                                                                                                    java_vm_ext.cc:710]         5 of android.view.ViewRootImpl$W (5 unique instances)
                                                                                                    java_vm_ext.cc:710]         4 of android.content.ContentProvider$Transport (4 unique instances)
                                                                                                    java_vm_ext.cc:710]         3 of java.lang.String (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         3 of dalvik.system.PathClassLoader (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.mrousavy.camera.frameprocessors.VisionCameraProxy (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.mrousavy.camera.frameprocessors.VisionCameraScheduler (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.swmansion.reanimated.AndroidUIScheduler (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.swmansion.reanimated.layoutReanimation.LayoutAnimations (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.hardware.camera2.CameraManager$CameraManagerGlobal (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.view.ThreadedRenderer$WebViewOverlayProvider (1 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of com.facebook.react.bridge.queue.MessageQueueThreadImpl (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of float[] (16 elements) (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of int[] (16 elements) (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of java.lang.ThreadGroup (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.opengl.EGLContext (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.opengl.EGLDisplay (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         2 of android.opengl.EGLSurface (2 unique instances)
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.bridge.RuntimeScheduler
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.bridge.RuntimeExecutor
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.react.modules.blob.BlobModule
                                                                                                    java_vm_ext.cc:710]         1 of com.swmansion.rnscreens.ScreensModule
                                                                                                    java_vm_ext.cc:710]         1 of com.reactlibrary.RNOpenCvLibraryModule
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.network.NetworkFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin
                                                                                                    java_vm_ext.cc:710]         1 of com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin
2024-10-16 14:19:36.989  9496-9595  com.meterwater          com.meterwater                       A  java_vm_ext.cc:710]         1 of com.facebook.flipper.android.FlipperClientImpl

Camera Device

{
  "formats": [],
  "hardwareLevel": "limited",
  "hasFlash": false,
  "hasTorch": false,
  "id": "10",
  "isMultiCam": false,
  "maxExposure": 6,
  "maxZoom": 1,
  "minExposure": -6,
  "minFocusDistance": 999.999985098839,
  "minZoom": 1,
  "name": "10 (BACK) androidx.camera.camera2",
  "neutralZoom": 1,
  "physicalDevices": [
    "ultra-wide-angle-camera"
  ],
  "position": "back",
  "sensorOrientation": "landscape-left",
  "supportsFocus": true,
  "supportsLowLightBoost": false,
  "supportsRawCapture": false
}

Device

Samsung Galaxy A03s

VisionCamera Version

4.5.3

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

maintenance-hans[bot] commented 1 month ago

Guten Tag, Hans here! 🍻

It looks like you are experiencing a runtime issue with your application closing due to a JNI error. Thank you for providing the logs, they're quite helpful. A maximum of 51200 global references indicates a possible memory leak in your frame processing.

However, I notice that you didn't try to reproduce the issue in the VisionCamera Example app. This step is essential to help mrousavy pinpoint whether the problem lies within your code or the library itself.

Please try to replicate the issue there, and if it persists, feel free to provide additional details about your implementation and we will investigate further.

And remember, if you want to ensure swift attention to such issues, consider supporting the project by becoming a sponsor! Check out sponsorship options here.

Looking forward to your update!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

kHanHnq4901 commented 1 month ago

source
// Bộ xử lý khung const frameProcessor = useSkiaFrameProcessor((frame) => { 'worklet';

// Hàm xử lý OpenCV
const openCvWorklet = (frame: FrameInternal) => {
    'worklet'; // Đánh dấu hàm này là worklet
    try {
        frame.incrementRefCount();
        const map = openCv(frame); // Giả định openCv là hàm xử lý OpenCV
        return map;
    } finally {
        frame.decrementRefCount();
    }
};

// Hàm vẽ trên khung hình
const drawOnFrame = (map: object) => {
    'worklet'; // Đánh dấu hàm này là worklet
    if (!map) return;
    frame.render(); // Render the frame before drawing
    const paint = Skia.Paint();
    paint.setColor(Skia.Color('red'));
    frame.drawLine(map.center_x - 10, map.center_y, map.center_x + 10, map.center_y, paint);
    frame.drawLine(map.center_x, map.center_y - 10, map.center_x, map.center_y + 10, paint);

    if (map.ptAx) {
        const paintRed = Skia.Paint();
        paintRed.setColor(Skia.Color('red'));
        const paintYellow = Skia.Paint();
        paintYellow.setColor(Skia.Color('yellow'));
        const paintBlue = Skia.Paint();
        paintBlue.setColor(Skia.Color('blue'));
        const paintBlack = Skia.Paint();
        paintBlack.setColor(Skia.Color('black'));

        frame.drawLine(map.ptAx, map.ptAy, map.ptBx, map.ptBy, paintRed);
        frame.drawLine(map.ptAx, map.ptAy, map.ptCx, map.ptCy, paintYellow);
        frame.drawLine(map.ptBx, map.ptBy, map.ptCx, map.ptCy, paintBlue);
        frame.drawLine(map.ptIx, map.ptIy, map.ptCx, map.ptCy, paintBlack);
    }
};

// Gọi hàm xử lý OpenCV và vẽ trên khung hình
const nativeBuffer = frame.getNativeBuffer(); // Lưu trữ nativeBuffer
const map = openCvWorklet(frame); // Gọi hàm xử lý OpenCV
// Vẽ trên khung hình
drawOnFrame(map);
const image = Skia.Image.MakeImageFromNativeBuffer(nativeBuffer.pointer);
image.dispose(); 
// Xóa buffer sau khi hoàn tất
nativeBuffer.delete(); 

}, []); <Camera key={cameraKey} style={StyleSheet.absoluteFill} device={device} isActive={isActive} zoom={zoom ? 7 : 1} frameProcessor={frameProcessor} enableFpsGraph={true} format={format} fps={[minFps, maxFps]} enableBufferCompression = {true}/>

kHanHnq4901 commented 4 weeks ago

@mrousavy