【发布时间】:2017-05-30 23:01:38
【问题描述】:
我正在使用 webrtc 进行视频通话。我的用例是我一个接一个地连接到队列中的用户。因此连接到 user1,结束与 user1 的连接,然后连接到 user2,依此类推。
有时在与用户断开连接并处理对等连接时,我会遇到本机崩溃
E/rtc(6882): #\
05-26 17:30:44.374: E/rtc(6882): # Fatal error in ../../webrtc/sdk/android/src/jni/peerconnection_jni.cc, line 1074\
05-26 17:30:44.374: E/rtc(6882): # last system error: 17\
05-26 17:30:44.374: E/rtc(6882): # Check failed: 0 == (reinterpret_cast<PeerConnectionInterface*>(j_p))->Release() (0 vs. 1)\
05-26 17:30:44.374: E/rtc(6882): # Unexpected refcount.\
05-26 17:30:44.374: E/rtc(6882): #\
此崩溃非常随机地发生,据我猜测是某些东西在处理时保留了对 peerconnection 的引用。
这是我处理对等连接的代码,我正在为新连接重用本地媒体流。
videoCapturer.stopCapture();
if (peerConnection != null) {
peerConnection.close();
peerConnection.removeStream(localMediaStream);
peerConnection.dispose();
peerConnection = null;
}
上面的 sn-p 是处理对等连接的正确方法吗?这次崩溃的随机性可能是什么原因?泄露的引用是在 Java 层还是原生层?
【问题讨论】:
标签: android android-ndk webrtc