Instance Method
setFrameCrypto(encrypt:decrypt:getMaxSize:userData:)
Installs, replaces, or removes frame crypto with C callbacks (the C callback version).
@discardableResult @MainActor func setFrameCrypto(encrypt: FrameEncryptCallback?, decrypt: FrameDecryptCallback?, getMaxSize: FrameGetMaxSizeCallback?, userData: UnsafeMutableRawPointer?) -> Int32Return Value
The RevueKit result code (0 on success).
Discussion
The callbacks work directly on the SDK’s buffers, so no frame is copied. For most Swift code, setFrameCryptor(_:) is simpler and lets the SDK manage memory.
To install, pass all three callbacks. To remove, pass
nilfor all three and foruserData, or callclearFrameCryptor(). Passing only some of them returns-2and keeps the current setting.Call it any time after
initialize, including during a call. Beforeinitializeit returns-1and installs nothing. The last installed version replaces the other one.The callbacks run synchronously on the SDK’s media threads, and audio and video can run at the same time: make them thread-safe and non-blocking, and do not call SDK APIs from them.
Important
userDatais owned by the App, and the SDK never retains or releases it. A media thread may still be using the previoususerDatawhen it is replaced or removed, so release a replaceduserDataonly afterdestroy()returns.