fix: Run CodeScanner on default queue, fix stalling (#2002)
* fix: Run CodeScanner on default queue, fix stalling * fix: Use `MAX_IMAGES` of 3
This commit is contained in:
parent
ea98112a21
commit
e8df7148fa
@ -11,7 +11,6 @@ class CameraQueues {
|
||||
companion object {
|
||||
val cameraQueue = CameraQueue("mrousavy/VisionCamera.main")
|
||||
val videoQueue = CameraQueue("mrousavy/VisionCamera.video")
|
||||
val codeScannerQueue = CameraQueue("mrousavy/VisionCamera.codeScanner")
|
||||
}
|
||||
|
||||
class CameraQueue(name: String) {
|
||||
|
@ -13,10 +13,10 @@ import java.io.Closeable
|
||||
|
||||
class CodeScannerPipeline(val size: Size, val format: Int, val output: CameraOutputs.CodeScannerOutput) : Closeable {
|
||||
companion object {
|
||||
// We want to have a buffer of 2 images, but we always only acquire one.
|
||||
// That way the pipeline is free to stream frames into the unused buffer,
|
||||
// We want to have a buffer of 3 images, but we always only acquire one.
|
||||
// That way the pipeline is free to stream up to two frames into the unused buffer,
|
||||
// while the other buffer is being used for code scanning.
|
||||
private const val MAX_IMAGES = 2
|
||||
private const val MAX_IMAGES = 3
|
||||
}
|
||||
|
||||
private val imageReader: ImageReader
|
||||
@ -29,7 +29,6 @@ class CodeScannerPipeline(val size: Size, val format: Int, val output: CameraOut
|
||||
val types = output.codeScanner.codeTypes.map { it.toBarcodeType() }
|
||||
val barcodeScannerOptions = BarcodeScannerOptions.Builder()
|
||||
.setBarcodeFormats(types[0], *types.toIntArray())
|
||||
.setExecutor(CameraQueues.codeScannerQueue.executor)
|
||||
.build()
|
||||
scanner = BarcodeScanning.getClient(barcodeScannerOptions)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user