From 1b90bc96207fc40460db3dca5d94074591a416ee Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Fri, 10 Nov 2023 12:08:39 +0100 Subject: [PATCH] fix: Fix a race condition that caused audio to not be configured (#2144) * fix: Fix a race condition that caused audio to not be configured * Update CameraSession.swift * fix: Fix `audioOutput` being deleted --- package/ios/Core/CameraSession+Configuration.swift | 1 - package/ios/Core/CameraSession.swift | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package/ios/Core/CameraSession+Configuration.swift b/package/ios/Core/CameraSession+Configuration.swift index c207a8d..a343935 100644 --- a/package/ios/Core/CameraSession+Configuration.swift +++ b/package/ios/Core/CameraSession+Configuration.swift @@ -62,7 +62,6 @@ extension CameraSession { } photoOutput = nil videoOutput = nil - audioOutput = nil codeScannerOutput = nil // Photo Output diff --git a/package/ios/Core/CameraSession.swift b/package/ios/Core/CameraSession.swift index 670161a..1155cb5 100644 --- a/package/ios/Core/CameraSession.swift +++ b/package/ios/Core/CameraSession.swift @@ -158,9 +158,6 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC } } - // Update successful, set the new configuration! - self.configuration = config - // Notify about Camera initialization if difference.inputChanged { self.delegate?.onSessionInitialized() @@ -188,6 +185,9 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC } } } + + // After configuring, set this to the new configuration. + configuration = config } /**