fix: Close previous Outputs to free memory

This commit is contained in:
Marc Rousavy 2023-10-10 19:17:36 +02:00
parent 10a44d5b79
commit 727fb39f01
No known key found for this signature in database
GPG Key ID: 83BEF0F19E8F5321
2 changed files with 2 additions and 0 deletions

View File

@ -178,6 +178,7 @@ class CameraSession(
val currentOutputs = outputs val currentOutputs = outputs
if (currentOutputs != null && currentOutputs.enableHdr != hdr) { if (currentOutputs != null && currentOutputs.enableHdr != hdr) {
// Update existing HDR for Outputs // Update existing HDR for Outputs
this.outputs?.close()
this.outputs = CameraOutputs( this.outputs = CameraOutputs(
currentOutputs.cameraId, currentOutputs.cameraId,
cameraManager, cameraManager,

View File

@ -98,6 +98,7 @@ class CameraOutputs(
} }
override fun close() { override fun close() {
previewOutput?.close()
photoOutput?.close() photoOutput?.close()
videoOutput?.close() videoOutput?.close()
codeScannerOutput?.close() codeScannerOutput?.close()