在我的应用程序中,我实现了webRTC
. 主持人开始直播,多个客人可以加入他观看他的直播,就像Facebook Live
或一样insta Live
。但是,当直播直播并且有任何客人时,我会在主持人端断开直播。它崩溃了。日志如下:
2020-06-26 15:48:46.523 15339-16113/com.example.webRTCApp E/rtc: #
# Fatal error in ../../webrtc/api/android/jni/peerconnection_jni.cc, line 990
# last system error: 88
# Check failed: 0 == (reinterpret_cast<MediaStreamInterface*>(j_p))->Release() (0 vs. 2)
# Unexpected refcount.
#
我已经正确关闭了对等连接,但我认为这不是我们通过多个连接关闭它的方式。
private void closeInternal() {
if (factory != null && peerConnectionParameters.aecDump) {
factory.stopAecDump();
}
Log.d(TAG, "Closing peer connection.");
statsTimer.cancel();
if (peerConnection != null) {
peerConnection.dispose();
peerConnection = null;
}
Log.d(TAG, "Closing audio source.");
if (audioSource != null) {
audioSource.dispose();
audioSource = null;
}
Log.d(TAG, "Stopping capture.");
if (videoCapturer != null) {
try {
videoCapturer.stopCapture();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
videoCapturerStopped = true;
videoCapturer.dispose();
videoCapturer = null;
}
Log.d(TAG, "Closing video source.");
if (videoSource != null) {
videoSource.dispose();
videoSource = null;
}
Log.d(TAG, "Closing peer connection factory.");
if (factory != null) {
factory.dispose();
factory = null;
}
options = null;
Log.d(TAG, "Closing peer connection done.");
events.onPeerConnectionClosed();
PeerConnectionFactory.stopInternalTracingCapture();
PeerConnectionFactory.shutdownInternalTracer();
}
我一直在寻找 3 三天,但一无所获。