From 367d95fc9a16bab88c3ec73e019726f4608b2c18 Mon Sep 17 00:00:00 2001 From: hiroshihorie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 26 Jun 2024 02:41:07 +0900 Subject: [PATCH] Fix FrameCryptor deadlock --- Sources/LiveKit/E2EE/E2EEManager.swift | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Sources/LiveKit/E2EE/E2EEManager.swift b/Sources/LiveKit/E2EE/E2EEManager.swift index 72b7880ba..3941677a1 100644 --- a/Sources/LiveKit/E2EE/E2EEManager.swift +++ b/Sources/LiveKit/E2EE/E2EEManager.swift @@ -113,13 +113,12 @@ public class E2EEManager: NSObject, ObservableObject, Loggable { return } - guard let frameCryptor = DispatchQueue.liveKitWebRTC.sync(execute: { - LKRTCFrameCryptor(factory: RTC.peerConnectionFactory, - rtpSender: sender, - participantId: participantIdentity.stringValue, - algorithm: .aesGcm, - keyProvider: e2eeOptions.keyProvider.rtcKeyProvider) - }) else { + guard let frameCryptor = LKRTCFrameCryptor(factory: RTC.peerConnectionFactory, + rtpSender: sender, + participantId: participantIdentity.stringValue, + algorithm: .aesGcm, + keyProvider: e2eeOptions.keyProvider.rtcKeyProvider) + else { log("frameCryptor is nil, skipping creating frame cryptor...", .warning) return } @@ -144,13 +143,12 @@ public class E2EEManager: NSObject, ObservableObject, Loggable { return } - guard let frameCryptor = DispatchQueue.liveKitWebRTC.sync(execute: { - LKRTCFrameCryptor(factory: RTC.peerConnectionFactory, - rtpReceiver: receiver, - participantId: participantIdentity.stringValue, - algorithm: .aesGcm, - keyProvider: e2eeOptions.keyProvider.rtcKeyProvider) - }) else { + guard let frameCryptor = LKRTCFrameCryptor(factory: RTC.peerConnectionFactory, + rtpReceiver: receiver, + participantId: participantIdentity.stringValue, + algorithm: .aesGcm, + keyProvider: e2eeOptions.keyProvider.rtcKeyProvider) + else { log("frameCryptor is nil, skipping creating frame cryptor...", .warning) return }