Сбой webRTC на peerConnection.dispose()
Я занимаюсь разработкой приложения для видеочата с использованием собственного WebRTC с моим сервером Java Signaling.
У меня есть успех создать связь, и она работает очень хорошо.
НО, когда я пытаюсь отключить звонок, приложение падает со следующим сообщением об ошибке:
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.
Сбой происходит, когда я вызываю peerConnection.dispose() или peerConnection.close();
Вот мой код для отключения вызова:
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();
}
Я попытался сначала вызвать peerConnection.dispose(), но он все еще не работал. Что бы ни пытались, это всегда сбой со следующим:
I/org.webrtc.Logging: NetworkMonitorAutoDetect: Unregister network callback
что я делаю не так?
2 ответа
Я исправил эту проблему, удалив peerConnectionFactory перед peerConnection.
@Override
public void disconnect() {
if(executor == null) return;
executor.execute(() -> {
localVideoTrack.dispose();
localVideoSource.dispose();
localAudioTrack.dispose();
localAudioSource.dispose();
peerConnectionFactory.dispose();
peerConnection.dispose();
});
executor.shutdown();
}
Я в onResume() добавляю NetworkMonitor.getInstance().startMonitoring(getActivity()); не найти эту аварию