Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS - Crash after trying sendTransport.close() #92

Open
kgenrih17 opened this issue Dec 15, 2020 · 8 comments
Open

iOS - Crash after trying sendTransport.close() #92

kgenrih17 opened this issue Dec 15, 2020 · 8 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@kgenrih17
Copy link

kgenrih17 commented Dec 15, 2020

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?

@kgenrih17
Copy link
Author

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"
};
* /`

@Bengua27
Copy link

@kgenrih17 hello, are you able to close "sendTransport" ? on my side, it crashes all the time.

Thanks

@Bengua27
Copy link

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"

@ethand91 ethand91 added bug Something isn't working help wanted Extra attention is needed labels Feb 17, 2021
@Henrikh91
Copy link

Thanks.

@fedulvtubudul
Copy link
Contributor

Please check this PR: #107. Still with memory leaks, but seems to fix the crash on disconnect.

@rushisangani
Copy link

rushisangani commented Sep 7, 2021

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.

@newOcean
Copy link

doesn't work for me.
does anyone use libmediasoup directly on ios?

@Henrikh91
Copy link

@rushisangani @fedulvtubudul thanks, working.

@newOcean yes, using and good working with 100+ users with audio + video streaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants