Fix QRCode scanner

This commit is contained in:
世界
2024-10-25 23:07:12 +08:00
parent 0de351375e
commit c6f71f5e47
3 changed files with 29 additions and 8 deletions

View File

@@ -29,7 +29,9 @@ class MLKitQRCodeAnalyzer(
override fun analyze(image: ImageProxy) {
if (image.image == null) return
if (failureOccurred && System.currentTimeMillis() - failureTimestamp < 1000L) {
val nowMills = System.currentTimeMillis()
if (failureOccurred && nowMills - failureTimestamp < 5000L) {
failureTimestamp = nowMills
Log.d("MLKitQRCodeAnalyzer", "throttled analysis since error occurred in previous pass")
image.close()
return