问题
Has anyone seen that error, literally:
"Uncaught DOMException: Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections"?
I guess it's happens because I didn't removed connections (maybe not, maybe it's because I didn't provide more memory or something). But from where? Where do they accumulate?
I didn't found answer for the question, literally, nowhere.
I was tried to solve that problem a couple days. By the way, no such thing as a stupid question, right?
UPD: Forgot to add that I using sip.js library.
回答1:
Found and fixed the problem. Sip.js library has a .close()
method that closes the peerConnection
. But this is not enough for a garbage collector. Object peerConnection
should be reset to null
.
So, the solving was adding two new lines in library, like
this.mediaHandler.peerConnection = null
and that's it. WebRTC is not crowded and all are happy.
来源:https://stackoverflow.com/questions/49532939/how-to-clear-rtcpeerconnection-webrtc