fix: Only close image once
This commit is contained in:
parent
9600a38398
commit
df32d2c5e9
@ -53,15 +53,11 @@ class CodeScannerPipeline(
|
|||||||
val inputImage = InputImage.fromMediaImage(image, Orientation.PORTRAIT.toDegrees())
|
val inputImage = InputImage.fromMediaImage(image, Orientation.PORTRAIT.toDegrees())
|
||||||
scanner.process(inputImage)
|
scanner.process(inputImage)
|
||||||
.addOnSuccessListener { barcodes ->
|
.addOnSuccessListener { barcodes ->
|
||||||
image.close()
|
|
||||||
isBusy = false
|
|
||||||
if (barcodes.isNotEmpty()) {
|
if (barcodes.isNotEmpty()) {
|
||||||
callback.onCodeScanned(barcodes, CodeScannerFrame(inputImage.width, inputImage.height))
|
callback.onCodeScanned(barcodes, CodeScannerFrame(inputImage.width, inputImage.height))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.addOnFailureListener { error ->
|
.addOnFailureListener { error ->
|
||||||
image.close()
|
|
||||||
isBusy = false
|
|
||||||
callback.onError(error)
|
callback.onError(error)
|
||||||
}
|
}
|
||||||
.addOnCompleteListener {
|
.addOnCompleteListener {
|
||||||
|
Loading…
Reference in New Issue
Block a user