mrousavy / react-native-vision-camera

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

🐛 runAsync(..) cannot be used #3255

Open kHanHnq4901 opened 1 month ago

kHanHnq4901 commented 1 month ago

What's happening?

Screenshot_1729485004

Reproduceable Code

import React, { useCallback, useEffect, useRef, useState } from 'react';
import { StyleSheet, View, Text, Button, StatusBar, Alert, TouchableOpacity } from 'react-native';
import { onEndPress, onResetPress, onStartPress ,onSavePress, onDisconnectPress, changeSaturation} from './handle';
import { store, GetHookProps } from './controller';
import { Camera, runAtTargetFps, useSkiaFrameProcessor,  useCameraFormat, getCameraDevice,runAsync, CameraPermissionRequestResult, useFrameProcessor } from "react-native-vision-camera";
import { Points, Skia } from '@shopify/react-native-skia';
import { openCv } from './controller';
import { useIsFocused } from '@react-navigation/native';
import LinearGradient from 'react-native-linear-gradient'; 
import { onSavePressSetting } from '../setting/handle';
import Slider from '@react-native-community/slider';
import { Worklets, useSharedValue } from 'react-native-worklets-core';

const Header = () => (
  <View style={styles.header}>
    <Text style={styles.headerText}>Phần mềm kiểm sai số Đồng hồ nước</Text>
  </View>
);

const App =(props: { navigation: any }) => {
  GetHookProps();
  const { navigation } = props;
  const isFocused = useIsFocused();
  const [appState] = useState("active");
  const isActive = isFocused && appState === "active";
  const [hasCameraPermission, setHasCameraPermission] = useState<boolean>(false);
  const [cameraKey, setCameraKey] = useState(0);
  const [zoom, setZoom] = useState(false);
  const [lastPress, setLastPress] = useState(0);
  const onZoomPress = () => {
    const now = Date.now();
    if (now - lastPress < 1000) { // 3 giây
      Alert.alert('Thông báo', 'Thao tác quá nhanh');
      return;
    }
    setLastPress(now);
    setZoom(!zoom);
  };

  useEffect(() => {
    const unsubscribe = navigation.addListener('focus', () => {
      // Hàm này sẽ được gọi khi màn hình ScanQrCodeScreen được focus (hiển thị)

      console.log('App Screen is focused');
      setCameraKey(prevKey => prevKey + 1);// Update cameraKey to refresh the camera
      setZoom(false)
    });

    const checkPermissions = async () => {
      const status: CameraPermissionRequestResult = await Camera.requestCameraPermission();

      if (status === 'granted') {
          setHasCameraPermission(true);
      } else {
          setHasCameraPermission(false);
          Alert.alert('Quyền truy cập camera đã bị từ chối, vui lòng cấp quyền cho camera.');
      }
  };
    checkPermissions();
    return unsubscribe;
  }, [navigation]);
  const devices = Camera.getAvailableCameraDevices()
  const device = getCameraDevice(devices, 'back', {
    physicalDevices: [
      'wide-angle-camera',
    ]
  })
// Bộ xử lý khung
const frameProcessor = useFrameProcessor((frame) => {
  'worklet'

  runAsync(frame, () => {
    'worklet'
    console.log("I'm running asynchronously, possibly at a lower FPS rate!")
  })
}, [])

  const format = useCameraFormat(device, [

    { videoResolution: { width: 640, height: 480 } },

  ])

  return (
    <View style={styles.container}>
      <StatusBar barStyle="dark-content" hidden={false} backgroundColor="#3498db" translucent={true} />
      <Header />
      <View style={styles.statusContainer}>
        <Text style={styles.statusText}>Trạng thái kết nối:</Text>
        <View
          style={[
            styles.statusDot,
            { backgroundColor: store.state.isConnected ? 'green' : 'red' }, // Green if connected, red if disconnected

          ]}
        />
      </View>
      <View style={styles.body}>
        <View style={styles.cameraContainer}>
          {hasCameraPermission === false ? (
            <Text>Vui lòng cấp quyền truy cập camera...</Text>
          ) : (
            device && (
              <Camera
                key={cameraKey}
                style={StyleSheet.absoluteFill}
                device={device}
                isActive={isActive}
                zoom={zoom ? 10 : 1}
                frameProcessor={frameProcessor}
                enableFpsGraph={true}
                format={format}
                fps={[30, 30]}
                enableBufferCompression = {true}
            />
            )
          )}
          <View style={styles.infoContainer}>
            <Text style={styles.text}>Serial: {store.state.serial}</Text>
            <Text style={styles.text}>Dàn: {store.state.staging}</Text>
            <Text style={styles.text}>Loại: {store.state.type === 1 ? 'Kiểm' : 'Mẫu'}</Text>
            {/* <Text style={styles.text}>Kim : {store.state.color === 1 ? 'Đỏ Nhạt ' : store.state.color === 2 ? 'Đỏ Tươi' : 'Đỏ Đậm'}</Text> */}
            <Text style={styles.text}>Sai số dh mẫu: {store.state.error} %</Text>
            <Text style={styles.text}>
            Lưu lượng kiểm: {store.state.tai === 1 ? 'QI' : store.state.tai === 2 ? 'QII' : store.state.tai === 3 ? 'QIII' : 'Q3'}
            </Text>
            <Text style={styles.text}>Lưu lượng thực tế: {store.state.flow.toFixed(4)} m3/h</Text>
          </View>
        </View>
      </View>
      <View style={styles.buttons}>
        <TouchableOpacity style={styles.button} onPress={onZoomPress}>
          <Text style={styles.buttonText}>{zoom ? 'Thu nhỏ' : 'Phóng to'}</Text>
        </TouchableOpacity>
        {store.state.type === 0 && (
          <>
            <TouchableOpacity
              style={[
                styles.button,
                { backgroundColor: store.state.isStart === false ? '#FF0000' : '#008000' } // Red for 'Kết thúc', Green for 'Bắt đầu'
              ]}
              onPress={store.state.isStart === false ? onEndPress : onStartPress}
            >
              <Text style={styles.buttonText}>
                {store.state.isStart === false ? 'Kết thúc' : 'Bắt đầu'}
              </Text>
            </TouchableOpacity>
            <TouchableOpacity style={styles.button} onPress={onSavePress}>
              <Text style={styles.buttonText}>Lưu</Text>
            </TouchableOpacity>
            <TouchableOpacity style={styles.button} onPress={onResetPress}>
              <Text style={styles.buttonText}>Làm mới</Text>
            </TouchableOpacity>
          </>
        )}
      </View>
      {/* {(store.state.color === 1 || store.state.color === 2) && ( */}
          <View>
            <Text>Điều chỉnh độ bão hòa: {store.state.saturation}</Text>
            <Slider
              style={{width: '100%', height: 40}}
              minimumValue={50}
              maximumValue={255}
              minimumTrackTintColor="#000000"
              maximumTrackTintColor="#000000"
              step={1}
              value={store.state.saturation}
              onValueChange={(value) => {
                store.setState({
                  ...store.state,
                  saturation: value,
                });
                changeSaturation(value); // Call the function to update saturation
              }}
            />
          </View>
        {/* )} */}
       <View style={styles.footer}>
        <View style={styles.footerItem}>
          <Text style={styles.footerTitle}>Lượng nước</Text>
          <Text style={[styles.footerValue, { color: 'green' }]}>
            {store.state.round.toString().slice(0, store.state.round.toString().indexOf('.') + 4)} lít
          </Text>
        </View>
        <View style={styles.footerItem}>
          <Text style={styles.footerTitle}>Chênh lệch</Text>
          <Text style={[styles.footerValue, { color: store.state.correction > 1 || store.state.correction < -1 ? 'red' : 'green' }]}>
            {store.state.false.toString().slice(0, store.state.false.toString().indexOf('.') + 4)} lít

          </Text>
        </View>
        <View style={styles.footerItem}>
          <Text style={styles.footerTitle}>Tỉ lệ</Text>
          <Text style={[styles.footerValue, { color: store.state.correction > 1 || store.state.correction < -1 ? 'red' : 'green' }]}>
            {store.state.ratio.toString().slice(0, store.state.false.toString().indexOf('.') + 4)} %
          </Text>
        </View>
        <View style={styles.footerItem}>
          <Text style={styles.footerTitle}>Sai số</Text>
          <Text style={[styles.footerValue, { color: store.state.correction > 1 || store.state.correction < -1 ? 'red' : 'green' }]}>
            {store.state.type === 0 ? (
              store.state.error + '%'
            ) : (
              store.state.correction.toString().slice(0, store.state.false.toString().indexOf('.') + 4) + '%'
            )}
          </Text>
        </View>
        <View style={styles.footerItem}>
          <Text style={styles.footerTitle}>Kết quả</Text>
          <Text style={[styles.footerValue, { color: store.state.correction > 1|| store.state.correction < -1 ? 'red' : 'green' }]}>
            {store.state.correction >1 || store.state.correction < -1 ? 'Không đạt' : 'Đạt'}
          </Text>
        </View>
      </View>
    </View>
  );
};

Relevant log output

ERROR  Frame Processor Error: Regular javascript function '' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet., js engine: VisionCamera

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 having some trouble with runAsync(..). One important thing, your log shows an error indicating that a regular JavaScript function cannot be shared. Make sure that you are decorating your function with the 'worklet' keyword to allow it to be used as a worklet.

Also, I see that you did not try to reproduce this issue in the VisionCamera Example app. It's important to do that, as it could help narrow down the problem. If the issue persists after trying the example app, please make sure to provide any relevant logs from there.

If you're not sure how to gather these logs, for Android you can use adb logcat, and for iOS, check the logs in Xcode. This information is crucial for mrousavy to help you!

Feel free to update your issue with more details, and we can take a closer look!

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

NFSMONSTR commented 1 month ago

May be related to #2820

Also for me helped setting babel.config like this

...
 plugins: [
      ['react-native-worklets-core/plugin'],
      ['react-native-reanimated/plugin', {processNestedWorklets: true}]
...      
kHanHnq4901 commented 1 month ago

That doesn't work, and it straight up crashes... this is my crash report from flipper:


Unknown


Build fingerprint: 'google/cheetah/cheetah:14/UQ1A.240105.004/11206848:user/release-keys' Revision: 'MP1.0' ABI: 'arm64' Timestamp: 2024-02-09 19:49:09.838956168+0200 Process uptime: 19s Cmdline: com.* pid: 22746, tid: 22956, name: mqt_js >>> com.*** <<< uid: 10398 tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE) signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x0000006ebd02d42d x0 0000000000000001 x1 00000074e5511248 x2 0000000000000000 x3 0000000000000000 x4 00000074e7805f10 x5 b400007537dc59e8 x6 0000000000000000 x7 00000073a34d88e3 x8 0000006e7e02c4e8 x9 0000006ebd02d408 x10 0000000000000003 x11 00000000dd000000 x12 00000074e78061c8 x13 0000000000000051 x14 0000000000000001 x15 0000006e7e022570 x16 0000000000000051 x17 0000000000000600 x18 00000074e769c000 x19 0000006e7dc00000 x20 00000074e7805d68 x21 00000074e7809000 x22 00000074e5511280 x23 fffa000000000000 x24 ffff006e7e02c4e8 x25 0000000000bfef50 x26 0000000000000000 x27 b400007537dc5990 x28 00000074e5511138 x29 00000074e7805d40 lr 0000007448c13480 sp 00000074e7805d40 pc 0000007448c1349c pst 0000000060001000 72 total frames backtrace:

00 pc 000000000016149c /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.***-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)

  #01 pc 00000000000ce538  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #02 pc 00000000000cc7c0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #03 pc 0000000000106888  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #04 pc 00000000000ef104  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #05 pc 00000000000ec554  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #06 pc 00000000000ce830  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #07 pc 0000000000095060  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #08 pc 000000000005a850  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libVisionCamera.so (offset 0x11b52000) (RNWorklet::JsiWorklet::call(std::__ndk1::shared_ptr<facebook::jsi::Function>, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)+332) (BuildId: 4024460c6f4361b8a3019c1cb6706c086a77f83f)
  #09 pc 0000000000059dd8  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libVisionCamera.so (offset 0x11b52000) (RNWorklet::WorkletInvoker::call(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)+140) (BuildId: 4024460c6f4361b8a3019c1cb6706c086a77f83f)
  #10 pc 00000000001a02a4  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (RNWorklet::JsiObjectWrapper::setFunctionValue(facebook::jsi::Runtime&, facebook::jsi::Value const&)::'lambda'(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) const+68) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #11 pc 00000000001a023c  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #12 pc 00000000001a0188  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (facebook::jsi::Value std::__ndk1::__invoke_void_return_wrapper<facebook::jsi::Value>::__call<RNWorklet::JsiObjectWrapper::setFunctionValue(facebook::jsi::Runtime&, facebook::jsi::Value const&)::'lambda'(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long>(RNWorklet::JsiObjectWrapper::setFunctionValue(facebook::jsi::Runtime&, facebook::jsi::Value const&)::'lambda'(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)&, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&)+120) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #13 pc 00000000001a0100  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #14 pc 000000000019ef84  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (std::__ndk1::__function::__func<RNWorklet::JsiObjectWrapper::setFunctionValue(facebook::jsi::Runtime&, facebook::jsi::Value const&)::'lambda'(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long), std::__ndk1::allocator<RNWorklet::JsiObjectWrapper::setFunctionValue(facebook::jsi::Runtime&, facebook::jsi::Value const&)::'lambda'(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>, facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*&&, unsigned long&&)+120) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #15 pc 000000000009c7f0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #16 pc 00000000000ce538  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #17 pc 00000000000ed0b0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #18 pc 00000000000ec554  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #19 pc 00000000000ce830  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #20 pc 0000000000095060  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libhermes.so (offset 0x2649000) (BuildId: db6fd99979b1c632a8aa7fc3fb1374981dc2c7c4)
  #21 pc 000000000005a850  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libVisionCamera.so (offset 0x11b52000) (RNWorklet::JsiWorklet::call(std::__ndk1::shared_ptr<facebook::jsi::Function>, facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)+332) (BuildId: 4024460c6f4361b8a3019c1cb6706c086a77f83f)
  #22 pc 0000000000059dd8  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libVisionCamera.so (offset 0x11b52000) (RNWorklet::WorkletInvoker::call(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)+140) (BuildId: 4024460c6f4361b8a3019c1cb6706c086a77f83f)
  #23 pc 000000000015ab44  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #24 pc 000000000015aa54  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #25 pc 000000000015a9f0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #26 pc 000000000015a9b0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #27 pc 0000000000159758  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #28 pc 000000000027db2c  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libreactnativejni.so (offset 0x3ff2000) (BuildId: bec7e5a2262e26ce)
  #29 pc 000000000027d5f4  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libreactnativejni.so (offset 0x3ff2000) (std::__ndk1::function<void (facebook::jsi::Runtime&)>::operator()(facebook::jsi::Runtime&) const+44) (BuildId: bec7e5a2262e26ce)
  #30 pc 0000000000157278  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #31 pc 0000000000157234  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #32 pc 00000000001571b8  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #33 pc 0000000000157164  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #34 pc 0000000000156014  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #35 pc 0000000000143600  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #36 pc 0000000000143570  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (std::__ndk1::function<void (RNWorklet::JsiWorkletContext*, facebook::jsi::Runtime&)>::operator()(RNWorklet::JsiWorkletContext*, facebook::jsi::Runtime&) const+80) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #37 pc 0000000000143510  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #38 pc 00000000001434ac  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #39 pc 0000000000143460  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #40 pc 0000000000143438  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #41 pc 00000000001422e0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #42 pc 0000000000019a90  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libfbjni.so (offset 0x226a000) (facebook::jni::detail::FunctionWrapper<void (*)(facebook::jni::alias_ref<facebook::jni::JClass>, long), facebook::jni::JClass, void, long>::call(_JNIEnv*, _jobject*, long, void (*)(facebook::jni::alias_ref<facebook::jni::JClass>, long))+200) (BuildId: 957a087554a7dd659c148d0560674b789d2844d0)
  #43 pc 0000000000355830  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #44 pc 000000000033f080  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #45 pc 00000000005111d4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2364) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #46 pc 000000000049774c  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+1840) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #47 pc 0000000000357fd8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #48 pc 00000000003b101c  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk (com.facebook.jni.ThreadScopeSupport.runStdFunction+0)
  #49 pc 0000000000374120  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.420609892041422114)+232) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #50 pc 0000000000373a18  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+964) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #51 pc 0000000000355968  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #52 pc 000000000033f080  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #53 pc 00000000004e1ea8  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+728) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #54 pc 000000000057b930  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+156) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #55 pc 00000000003dc208  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType) (.__uniq.99033978352804627313491551960229047428)+624) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #56 pc 000000000054da40  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list) (.__uniq.99033978352804627313491551960229047428.llvm.9379289081322328196)+60) (BuildId: 735f12f804f88d62a2cb437261076ff7)
  #57 pc 0000000000019ea4  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libfbjni.so (offset 0x226a000) (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: 957a087554a7dd659c148d0560674b789d2844d0)
  #58 pc 0000000000019590  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libfbjni.so (offset 0x226a000) (facebook::jni::ThreadScope::WithClassLoader(std::__ndk1::function<void ()>&&)+184) (BuildId: 957a087554a7dd659c148d0560674b789d2844d0)
  #59 pc 0000000000141900  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #60 pc 0000000000141854  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #61 pc 0000000000141808  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #62 pc 00000000001417e0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #63 pc 00000000001405b0  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #64 pc 00000000001eae98  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libreactnativejni.so (offset 0x3ff2000) (BuildId: bec7e5a2262e26ce)
  #65 pc 00000000001ead88  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!libreactnativejni.so (offset 0x3ff2000) (std::__ndk1::function<void ()>::operator()() const+20) (BuildId: bec7e5a2262e26ce)
  #66 pc 00000000001779a4  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (RNWorklet::DispatchQueue::dispatch_thread_handler()+228) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #67 pc 0000000000179968  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #68 pc 0000000000179874  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #69 pc 000000000017919c  /data/app/~~FSywDNfZ_bfstefKi9tnAw==/com.*******-atp5BqxQzqvZiGGhJ5L2LQ==/base.apk!librnworklets.so (offset 0x5315000) (BuildId: 371ddf5f821b2248e04c5e7ad2fab66b8f369f28)
  #70 pc 00000000000c9ccc  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
  #71 pc 000000000005db00  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
xulihang commented 1 month ago

This seems a conflict with react-native-reanimated as they all use the worklet keyword.

gwendall commented 4 weeks ago

Same here

babldev commented 1 week ago

Seeing this issue on iOS and Android.

ERROR Frame Processor Error: Regular javascript function '' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet., js engine: VisionCamera

const frameProcessorHandler = (frame: Frame) => {
    'worklet'
    runAsync(frame, () => {
      'worklet'
    });
  };
babldev commented 1 week ago

Related https://github.com/margelo/react-native-worklets-core/issues/136