mediasoup-ios-client
mediasoup-ios-client copied to clipboard
iOS - Crash after trying sendTransport.close()
There are no entries to logs. But before that, the transport changes the status "onConnectionStateChange to:" closed ""
info: There are two sending transports:
- audio
- video and Two receiving transports:
- audio
- video
Thread 1: EXC_BAD_ACCESS (code=1, address=0x146826de0)
class LocalClient: NSObject {
private(set) var transports: [String: SendTransport] = [ : ]
func close() {
transports.values.forEach { (sendTransport) in
guard !sendTransport.isClosed() else {
return
}
sendTransport.close()
}
}
}
What am I doing wrong when closing?
Found a solution to the problem. Are there any other ways to shut down transport, in any other case?
// SendTransportListener / RecvTransportListener
func onConnectionStateChange (_ transport: Transport !, connectionState: String!) {
guard let peerConnectionState = RTCPeerConnectionState (rawValue: connectionState) else {
return
}
switch peerConnectionState {
case .disconnected, .failed:
transport.close ()
default:
return
}
// connectionState is RTCPeerConnectionState
/ *
enum RTCPeerConnectionState {
"closed",
"failed",
"disconnected",
"new",
"connecting",
"connected"
};
* /`
@kgenrih17 hello, are you able to close "sendTransport" ? on my side, it crashes all the time.
Thanks
Hello,
I fixed the issue:
- call close when you are closing the call and the status of sendTransport is "disconnected"
- call stop of the mediaCapture when the status of sendTransport is "closed"
Thanks.
Please check this PR: https://github.com/ethand91/mediasoup-ios-client/pull/107. Still with memory leaks, but seems to fix the crash on disconnect.
Hello,
I fixed the issue:
- call close when you are closing the call and the status of sendTransport is "disconnected"
- call stop of the mediaCapture when the status of sendTransport is "closed"
@Bengua27 Could you please tell me how you've solved this crash? I can not find stop method in the MediaCapture class.
doesn't work for me. does anyone use libmediasoup directly on ios?
@rushisangani @fedulvtubudul thanks, working.
@newOcean yes, using and good working with 100+ users with audio + video streaming.