New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃挱 Use runAsync
every time it finishes executing
#2520
Comments
AsyncExec
every time it finishes executing 馃挱 runAsync
every time it finishes executing 馃挱
runAsync
every time it finishes executing 馃挱 runAsync
every time it finishes executing
VisionCamera 8.0.2? Are you from the future? Does VisionCamera V8 have Skia Frame Processors already? 馃憖 |
Also, I'm not sure if I get your question. You want to run something on another Thread, then use |
I assume he means it should only process 1 frame sequentially, and drop any frames that are aquired whilst still processing. |
Yep, this is exactly what |
Since
Also, when I try to use
(also completely unrelated but do you have any frame processing libraries - for stuff like thresholding - you can recommend? I couldn't find anything and had to resort to doing this awful average calculation using a god-damn loop) |
Did you enable processNestedWorklets in the reanimated plugin? We recently fixed that crash in latest VC/Worklets versions, so it might be the plugin not transpiling properly. Also, as always, I need the native logs to debug further. |
I don't even use reanimated. If it's a dependency I must install, where does it say it? I followed your installation guide. That's my babel config:
How can I get you the native logs from Flipper? |
Update:
I get the width printed endlessly But when I try to do something with the frame like:
Nothing happens - it doesn't even crash, just nothing happens I saw there's a beta of |
Ah yeah then no, you dont need reanimated. But you shouldn't use runOnJS, just runAsync: runAsync(frame, () => {
'worklet'
// your code
}) |
That doesn't work, and it straight up crashes... this is my crash report from flipper:
|
runAsync gives me an error:
Using 3.9.0 beta 3. runAtTargetFps works well. |
Did you guys try Just compare your versions with the example app, maybe it is a REA compatibility issue, a Babel issue, or a RN Worklets issue? |
I also have this exact problem and
|
|
runAsync crashes for me actually. I can do a simple console.log inside just fine, but if I do anything more like resize or resize + tflite, it crashes with no error like tomer described. Seems like the more complex the functions the faster it will crash. Just resize will crash after about 4-8 seconds. Resize + tflite will crash right away. On a pixel 7. |
Same issue here, even with react-native-vision-camera 4.0.1 and react-native-worklets-core 1.1.1 Edit: This is my logcat:
|
I think I found the issue. The current behavior is: I did a dirty workaround that fixed the issue on my side, by removing the "VisionCamera.async" context, and making both SharedArray and runAsync use the default worklet context.
@mrousavy Please let me know if I'm missing something. Thanks. |
Hey @TheGhostFish - unfortunately this isn't as simple as it sounds. Moving SharedArrays between contexts is really dangerous as the data is just not thread safe. So the real solution is to implement SharedArray proxying/copying. Your patch might work as a temporary solution though - where it previously was bound to FP runtime only, you can not use it in Worklets default context only. |
@mrousavy Any other ideas to workaround here? I'm running into the same issue, trying to use the resize plugin inside runAsync. The plugin runs fine but trying to access the returned value crashes the app. |
Question
I have a document detection model I want to run but it's slow, I don't want to hard-lock to running it once every second (with
runAtTargetFps(1, ...)
) but rather want it to execute sequentially in a different thread.I.E. the next call to my callback should be immediately after the previous call has finished, independent of the FPS or what frame it is
What I tried
I know I can technically wrap some logic into
runAsync
that'll check if the previous call has finished - or use a recursive call in a one-off thingBut institutively this utility seems (to me at least) useful when dealing with frame processing, so maybe a sister function to
runAsync
andrunAtTargetFps
could be introduced?VisionCamera Version
8.0.2
Additional information
The text was updated successfully, but these errors were encountered: