diff --git a/Sources/Media/IOVideoMixer.swift b/Sources/Media/IOVideoMixer.swift index dc9c91e61..c3791be98 100644 --- a/Sources/Media/IOVideoMixer.swift +++ b/Sources/Media/IOVideoMixer.swift @@ -15,7 +15,13 @@ final class IOVideoMixer { var muted = false var multiCamCaptureSettings: MultiCamCaptureSettings = .default weak var delegate: T? - var context: CIContext = .init() + var context: CIContext = .init() { + didSet { + for effect in effects { + effect.ciContext = context + } + } + } private var extent = CGRect.zero { didSet { guard extent != oldValue else { diff --git a/Sources/Media/IOVideoUnit.swift b/Sources/Media/IOVideoUnit.swift index c39badf6a..30e6f359c 100644 --- a/Sources/Media/IOVideoUnit.swift +++ b/Sources/Media/IOVideoUnit.swift @@ -74,7 +74,17 @@ final class IOVideoUnit: NSObject, IOUnit { } #endif - var context: CIContext = .init() + var context: CIContext { + get { + return lockQueue.sync { self.videoMixer.context } + } + set { + lockQueue.async { + self.videoMixer.context = newValue + } + } + } + var isRunning: Atomic { return codec.isRunning }