We found a crash in the call sdk

Version: iOS SendBirdCalls 1.9.2
Device: iPhonse XR, 14.4.1

BjGKbEx5Gx79HDpF8_uA0s.xccrashpoint.zip (220.4 KB)

Hi @James, thanks for reporting this issue.
Would you be able to share the code snippet that calls this function?

Hi @mininny

  1. Our app has a function that notifies the other party through the UI when the user is talking (when making a sound).
  2. So, the sound is caught through ARAudioRecognizer, and the value is passed through ‘call.updateCustomItems’ and processed.
  3. The setAudioRecognizerAndReceiver function is called when the call starts.

Lib

func setAudioRecognizerAndReceiver(receiver: ((_ value: String?) -> Void)?) {
                
        self.receiverAudioLevel = receiver
        
        var prevValue = 0
        
        self.audioRecognizer = TCARAudioRecognizer()
        self.audioRecognizer?.startAudioRecognizer()
        self.audioRecognizer?.voiceAudioPower = { averagePower in
            
            if let userId = AuthManager.userIdString {
                
                let value = averagePower > -40 ? 1 : 0
                                
                if value == prevValue {
                    return
                }
                
                prevValue = value
                
                self.call?.updateCustomItems(customItems: [userId:String(value)], completionHandler: { items, keys, error in
                })
            }
        }
    }
//ARAudioRecognizer
class TCARAudioRecognizer: NSObject, ARAudioRecognizerDelegate { 
    var audioRecognizer: ARAudioRecognizer?
    
    var voiceAudioLevel: ((_ level: Float) -> Void)? = nil
    var voiceAudioPower: ((_ averagePower: Float) -> Void)? = nil
    
    func startAudioRecognizer() {
        self.audioRecognizer = ARAudioRecognizer()
        self.audioRecognizer?.delegate = self
    }
    
    func stopAudioRecognizer() {
        self.audioRecognizer?.stop()
        self.voiceAudioLevel = nil
        self.voiceAudioPower = nil
    }
    
    //[ARAudioRecognizerDelegate
    func audioRecognized(_ recognizer: ARAudioRecognizer!) {

    }
    
    func audioLevelUpdated(_ recognizer: ARAudioRecognizer!, level lowPassResults: Float) {
        self.voiceAudioLevel?(lowPassResults)
    }
    
    func audioLevelUpdated(_ recognizer: ARAudioRecognizer!, averagePower: Float, peakPower: Float) {
        self.voiceAudioPower?(averagePower)
    }
    //]
}