You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using VisionCamera with frame processors enabled with @ismaelmoreiraa/vision-camera-ocr:3.0.1.
It's a simple code that apply a Regex Validation out of a frame trough the FrameProcessor.
It's work perfectly in local / Debug (Expo 50) but when I build and use on Android (Release) the application crash with the trace below.
I saw this issue that was previously fixed apparently (it could be related maybe) -> 42ae179
I've try a lot of things, like tweaking the version and all, before coming here and hope get some help about this.
I certainly did something wrong since I didn't saw similar new issues, any idea ?
Thanks in advance !
Reproduceable Code
exportdefaultfunctionScanScreen(){constdevice=useCameraDevice('back');// ... constocr=useSharedValue({})constprocessing=useSharedValue(false)constparseOcr=useRunOnJS(()=>{letmatchFound=false;constscannedBlocks=ocr.value.result?.blocks;if(scannedBlocks?.length>0){scannedBlocks.forEach((block)=>{block.lines.forEach((line)=>{// REGEX CHECK});});}if(!matchFound){processing.value=false;}},[])/** Process camera frames */constframeProcessor=useFrameProcessor((frame)=>{'worklet'if(processing.value===false){processing.value=true;runAsync(frame,()=>{'worklet'runAtTargetFps(10,()=>{'worklet'constimage=scanOCR(frame);if(image){try{ocr.value=image;parseOcr();}finally{processing.value=false;}}else{processing.value=false;}})});}},[],)constpermissionFunction=async()=>{ExpoCam.getCameraPermissionsAsync().then((res)=>{if(!res.canAskAgain){Linking.openSettings();}else{getPermission()}})}return(<Camerastyle={{height: Dimensions.get('window').height+(Platform.OS!=="ios" ? StatusBar.currentHeight : 0)}}frameProcessor={frameProcessor}device={device}pixelFormat={"yuv"}isActive={true}photo={true}format={format}></Camera>);};
Relevant log output
Failed to acquire image.
java.lang.IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more.
at android.media.ImageReader.acquireNextImage(ImageReader.java:560)
at androidx.camera.core.AndroidImageReaderProxy.acquireNextImage(AndroidImageReaderProxy.java:88)
at androidx.camera.core.SafeCloseImageReaderProxy.acquireNextImage(SafeCloseImageReaderProxy.java:88)
at androidx.camera.core.ImageAnalysisBlockingAnalyzer.acquireImage(ImageAnalysisBlockingAnalyzer.java:41)
at androidx.camera.core.ImageAnalysisAbstractAnalyzer.onImageAvailable(ImageAnalysisAbstractAnalyzer.java:128)
at androidx.camera.core.SafeCloseImageReaderProxy.lambda$setOnImageAvailableListener$1$androidx-camera-core-SafeCloseImageReaderProxy(SafeCloseImageReaderProxy.java:213)
at androidx.camera.core.SafeCloseImageReaderProxy$$ExternalSyntheticLambda1.onImageAvailable(Unknown Source:4)
at androidx.camera.core.AndroidImageReaderProxy.lambda$setOnImageAvailableListener$0$androidx-camera-core-AndroidImageReaderProxy(AndroidImageReaderProxy.java:169)
at androidx.camera.core.AndroidImageReaderProxy$$ExternalSyntheticLambda0.run(Unknown Source:4)
subskill-anezzar
changed the title
馃悰 Android: maxImages (6) has already been acquired
馃悰 [Android] maxImages (6) has already been acquired
May 22, 2024
subskill-anezzar
changed the title
馃悰 [Android] maxImages (6) has already been acquired
馃悰 [V4][Android] Release crash: maxImages (6) has already been acquired
May 22, 2024
Finally, I did the STRATEGY_KEEP_ONLY_LATEST (#2826) modification, since I first wanted to prevent lags while using scanOCR of vision-camera-ocr. I still don't know what caused runAsync to create the Release crash (see above).
Anyway, I hope getting around this without patching the package with that last modification since it is apparently not a good idea but it's all I got :)
What's happening?
Hello 馃憢
I am using VisionCamera with frame processors enabled with @ismaelmoreiraa/vision-camera-ocr:3.0.1.
It's a simple code that apply a Regex Validation out of a frame trough the FrameProcessor.
It's work perfectly in local / Debug (Expo 50) but when I build and use on Android (Release) the application crash with the trace below.
I saw this issue that was previously fixed apparently (it could be related maybe) -> 42ae179
I've try a lot of things, like tweaking the version and all, before coming here and hope get some help about this.
I certainly did something wrong since I didn't saw similar new issues, any idea ?
Thanks in advance !
Reproduceable Code
Relevant log output
Camera Device
Device
Galaxy A12
VisionCamera Version
4.0.5
Can you reproduce this issue in the VisionCamera Example app?
No, I cannot reproduce the issue in the Example app
Additional information
The text was updated successfully, but these errors were encountered: