twilio / twilio-video-ios

Programmable Video SDK by Twilio
http://twilio.com/video
Other
64 stars 22 forks source link

Application is getting crashed if we continuously publish / unpublish the audio or video track. #224

Open naresh-kumar-ios opened 2 years ago

naresh-kumar-ios commented 2 years ago

Description

Actually, in my application I am publishing and unpublishing the audio and video tracks when user mute / unmute audio and enable / disable the camera. After 2 three continues tap the application is getting crashed.

I tried to disable the mic button interaction until the audio is not published, as we get callback in localParticipantDidPublishAudioTrack but for un-publish there is no callback. That logic is also crashing. Please suggest me how can I fix this crash

Also please suggest what will be the side effect if I will enable/disable the audio track instead of publish / unpublish. Also what is the recommended approach for both audio and video

Steps to Reproduce

While on the call try monkey tap on mute button and from the code inside publish & unpublish the audio track on each respective tap

Code


@IBAction func micControlAction(_ sender: Any) {
        //Toggle mic
        guard let participant = callViewModel.getCallParticipant(type: .patient) else { return }
        if let audioTrack = participant.audioTrack as? LocalAudioTrack {
            if audioTrack.isEnabled {
                (participant.participant as? LocalParticipant)?.unpublishAudioTrack(audioTrack)
            }
            else {
                (participant.participant as? LocalParticipant)?.publishAudioTrack(audioTrack)
            }
            audioTrack.isEnabled = !audioTrack.isEnabled
            //This will call the observer and the UI will gets updated according to the need
            participant.micEnabled.property = audioTrack.isEnabled
      }
 }

Expected Behavior

The user should be able to mute / unmute the mic without any delay.

Actual Behavior

Application is getting crashed.

Reproduces How Often

100%

Logs

libc++abi.dylib: Pure virtual function called!
Pure virtual function called!

Versions

Video iOS SDK

4.6.0 via CocoaPods

Xcode

13.1

iOS Version

13.6.1

iOS Device

iPad Air