我正在使用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;
}
是上述片段正确的处理对等连接的方法吗?这次崩溃的随机性可能是什么原因?泄露的引用是Java层还是本机层?