I am developing video chat application using native WebRTC with my Java Signaling Server.
I have success create the connection and it working very well.
BUT, when i am trying to disconnect the call, the application is crashed with the following error message:
D/ZCF: Closing audio source.
Stopping capture.
I/org.webrtc.Logging: CameraCapturer: Stop capture
CameraCapturer: Stop capture: Nulling session
I/org.webrtc.Logging: CameraCapturer: Stop capture done
CameraCapturer: dispose
CameraCapturer: Stop capture
CameraCapturer: Stop capture: No session open
I/org.webrtc.Logging: Camera1Session: Stop camera1 session on camera 1
I/org.webrtc.Logging: CameraCapturer: Stop capture done
D/ZCF: Closing video source.
D/ZCF: Closing peer connection.
I/org.webrtc.Logging: Camera1Session: Stop internal
SurfaceTextureHelper: stopListening()
I/ZCF: onIceConnectionChange CLOSED
I/org.webrtc.Logging: WebRtcAudioRecord: stopRecording
WebRtcAudioRecord: stopThread
I/org.webrtc.Logging: WebRtcAudioEffects: release
I/org.webrtc.Logging: WebRtcAudioRecord: releaseAudioResources
I/org.webrtc.Logging: HardwareVideoEncoder: Releasing MediaCodec on output thread
I/org.webrtc.Logging: HardwareVideoEncoder: Release on output thread done
I/org.webrtc.Logging: AndroidVideoDecoder: release
I/org.webrtc.Logging: Camera1Session: Stop done
I/org.webrtc.Logging: Camera1Session: Bytebuffer frame captured but camera is no longer running.
I/org.webrtc.Logging: AndroidVideoDecoder: Releasing MediaCodec on output thread
D/SurfaceUtils: disconnecting from surface 0x713adfd010, reason disconnectFromSurface
I/org.webrtc.Logging: AndroidVideoDecoder: Release on output thread done
I/org.webrtc.Logging: SurfaceTextureHelper: stopListening()
I/org.webrtc.Logging: SurfaceTextureHelper: dispose()
I/org.webrtc.Logging: WebRtcAudioTrack: stopPlayout
WebRtcAudioTrack: underrun count: 1
I/org.webrtc.Logging: WebRtcAudioTrack: stopThread
WebRtcAudioTrack: Stopping the AudioTrackThread...
I/org.webrtc.Logging: WebRtcAudioTrack: Calling AudioTrack.stop...
D/AudioTrack: stop() called with 324000 frames delivered
I/org.webrtc.Logging: WebRtcAudioTrack: AudioTrack.stop is done.
I/org.webrtc.Logging: WebRtcAudioTrack: AudioTrackThread has now been stopped.
I/org.webrtc.Logging: WebRtcAudioTrack: releaseAudioResources
V/AudioTrack: ~AudioTrack, releasing session id 26833 from 19927 on behalf of 19927
I/org.webrtc.Logging: NetworkMonitor: Stop monitoring with native observer 486337727744
I/org.webrtc.Logging: NetworkMonitorAutoDetect: Unregister network callback
E/rtc: #
# Fatal error in: ../../../../usr/local/google/home/sakal/code/webrtc-aar-release/src/pc/peerconnection.cc, line 6729
# last system error: 0
# Check failed: observer_
#
A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 20013 (signaling_threa), pid 19927 (i.myapplication)
Application terminated.
The crash is occurred when i am calling peerConnection.dispose() or peerConnection.close();
here is my code for disconnect the call:
private void callDisconnect() {
if (peerConnectionFactory != null) {
peerConnectionFactory.stopAecDump();
}
Log.d("ZCF", "Closing audio source.");
if (audioSource != null) {
audioSource.dispose();
audioSource = null;
}
Log.d("ZCF", "Stopping capture.");
if (videoCapturer != null) {
try {
videoCapturer.stopCapture();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
videoCapturer.dispose();
videoCapturer = null;
}
Log.d("ZCF", "Closing video source.");
if (videoSource != null) {
videoSource.dispose();
videoSource = null;
}
Log.d("ZCF", "Closing peer connection.");
if (peerConnection != null) {
peerConnection.dispose();
peerConnection = null;
}
Log.d("ZCF", "Closing peer connection factory.");
if (peerConnectionFactory != null) {
peerConnectionFactory.dispose();
peerConnectionFactory = null;
}
rootEglBase.release();
Log.d("ZCF", "Closing peer connection done.");
PeerConnectionFactory.stopInternalTracingCapture();
PeerConnectionFactory.shutdownInternalTracer();
}
I have tried to call the peerConnection.dispose() first but it still crashed. Whatever is have tried, it always crashed with the following:
I/org.webrtc.Logging: NetworkMonitorAutoDetect: Unregister network callback
what i am doing wrong?