fix android possible waiting for image issue (#7994)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-05-09 18:59:51 +08:00 committed by GitHub
parent 6743b4f290
commit a595d83232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -338,9 +338,7 @@ class MainService : Service() {
).apply {
setOnImageAvailableListener({ imageReader: ImageReader ->
try {
if (!isStart) {
return@setOnImageAvailableListener
}
// If not call acquireLatestImage, listener will not be called again
imageReader.acquireLatestImage().use { image ->
if (image == null || !isStart) return@setOnImageAvailableListener
val planes = image.planes