android / android/camera-samples

java.lang.IndexOutOfBoundsException, because of YuvToRgbConverter.yuvToRgb

Aperta
#377 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Kotlin
Stelle
5.5k
Fork
2.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hello, we use cameraX for the production and started to notice increasing crashes, because of the ** yuvToRgb** (specifically _**imageToByteArray(image: Image, outputBuffer: ByteArray)**_) [YuvToRgbConverter](https://github.com/android/camera-samples/blob/main/CameraUtils/lib/src/main/java/com/example/android/camera/utils/YuvToRgbConverter.kt) starting camera x core beta version ~20.

We use this class for converting Image from cameraX to Bitmap and it is an official recommendation from Google themselves.

Perpahs you should update the code because it is not stable anymore? Or please provide another solution for converting Image to the Bitmap.

Here is the list of devices with the crash:
CUBOT X19
Samsung Galaxy S9+
HUAWEI Y7 2019
BQru-5514G

The full crash log:

`Fatal Exception: java.lang.IndexOutOfBoundsException
off=1382400, len=1920 out of bounds (size=1382407)
java.nio.Buffer.checkBounds (Buffer.java:559)
java.nio.DirectByteBuffer.get (DirectByteBuffer.java:234)
com.idenfy.idenfySdk.documentscamerasession.ui.utils.CustomBitmapConverter.imageToByteArray (CustomBitmapConverter.java:117)
com.idenfy.idenfySdk.documentscamerasession.ui.utils.CustomBitmapConverter.convertYuvToBitmap (CustomBitmapConverter.java:41)
com.idenfy.idenfySdk.documentscamerasession.ui.utils.CustomDocumentImageProcessor.analyze (CustomDocumentImageProcessor.java:76)
androidx.camera.core.ImageAnalysis.lambda$setAnalyzer$1 (ImageAnalysis.java:367)
java.lang.Thread.run (Thread.java:784)`

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Read CameraUtils/lib/src/main/java/com/example/android/camera/utils/YuvToRgbConverter.kt, starting at imageToByteArray and yuvToRgb, and compare their buffer handling with the provided IndexOutOfBoundsException. Run the relevant CameraX sample or tests if available and verify that conversion no longer throws for the reported image formats and devices.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, kotlin
Ambito
mobile-dev
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.