如何清除RTCPeerConnection(WebRTC)? [英] How to clear RTCPeerConnection (WebRTC)?

查看:1305
本文介绍了如何清除RTCPeerConnection(WebRTC)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从字面上看有没有人看到该错误:

Has anyone seen that error, literally:

"未捕获的DOMException:无法构造'RTCPeerConnection':无法创建那么多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:忘记添加我使用sip.js库.

UPD: Forgot to add that I using sip.js library.

推荐答案

找到并解决了该问题. Sip.js库具有关闭peerConnection.close()方法.但这对于垃圾收集器来说还不够.对象peerConnection应该重置为null.

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

this.mediaHandler.peerConnection = null

就是这样. WebRTC并不拥挤,所有人都很高兴.

and that's it. WebRTC is not crowded and all are happy.

这篇关于如何清除RTCPeerConnection(WebRTC)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆