harperdev7
harperdev7

Reputation: 163

App crashing on disconnecting call webRTC android

In my app, I have implemented webRTC. A host goes live and multiple guests can join him to watch his stream just like Facebook Live or insta Live. But when a stream is live and have any guests, I disconnect the stream by host side. It crashes. The Log is given below:

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.
#

I have closed peer connection correctly but I think that's not how we close it with multiple connections.

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();
}

I have been searching for 3 three days but nothing got.

Upvotes: 4

Views: 578

Answers (0)

Related Questions