我正在使用libjingle (version-9127)在android中实现webrtc,问题是,当我尝试拨打电话时,在一个应用程序生命周期中,第一个呼叫成功建立,然后结束。但是当第二次呼叫时,当呼叫得到接机时,视频显示,但音频流没有传输,然后在3-7秒后应用程序崩溃给出此错误。完整的logcat错误如下:
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/AudioRecordJni: BuiltInAECIsAvailable@[tid=23918]
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/AudioManager: SetCommunicationMode(1)@[tid=23918]
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioManager: setCommunicationMode(true)@[name=Thread-1692 - 23918, id=1699]
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/AudioRecordJni: InitRecording@[tid=23918]
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: InitRecording(sampleRate=48000, channels=1)
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: byteBuffer.capacity: 960
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/AudioRecordJni: OnCacheDirectBufferAddress
08-25 13:47:12.099 20887-23918/com.justtotaltech.tagove.app D/AudioRecordJni: direct buffer capacity: 960
08-25 13:47:12.109 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: AudioRecord.getMinBufferSize: 4096
08-25 13:47:12.109 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: bufferSizeInBytes: 4096
08-25 13:47:12.109 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: AudioRecord session ID: 299, audio format: 2, channels: 1, sample rate: 48000
08-25 13:47:12.109 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: AcousticEchoCanceler.isAvailable: false
08-25 13:47:12.129 20887-23918/com.justtotaltech.tagove.app D/AudioRecordJni: frames_per_buffer: 480
08-25 13:47:12.129 20887-23918/com.justtotaltech.tagove.app D/AudioRecordJni: StartRecording@[tid=23918]
08-25 13:47:12.129 20887-23918/com.justtotaltech.tagove.app D/WebRtcAudioRecord: StartRecording
08-25 13:47:12.159 20887-24120/com.justtotaltech.tagove.app D/WebRtcAudioRecord: AudioRecordThread@[name=AudioRecordJavaThread, id=1707]
08-25 13:47:12.159 20887-24120/com.justtotaltech.tagove.app E/AudioRecord: start() status -38
08-25 13:47:12.159 20887-24120/com.justtotaltech.tagove.app W/dalvikvm: threadid=41: thread exiting with uncaught exception (group=0x41687d58)
08-25 13:47:15.232 20887-24120/com.justtotaltech.tagove.app E/AndroidRuntime: FATAL EXCEPTION: AudioRecordJavaThread
Process: com.justtotaltech.tagove.app, PID: 20887
java.lang.AssertionError: Expected condition to be true
at org.webrtc.voiceengine.WebRtcAudioRecord.assertTrue(WebRtcAudioRecord.java:259)
at org.webrtc.voiceengine.WebRtcAudioRecord.access$300(WebRtcAudioRecord.java:29)
at org.webrtc.voiceengine.WebRtcAudioRecord$AudioRecordThread.run(WebRtcAudioRecord.java:79)
Edit:断开我所做的呼叫代码。希望你们能找出错误是什么。在此之后,我释放peerConnections
if(mediaStream != null && isLocal) {
mediaStream.removeTrack(audioTrack);
audioTrack.setState(MediaStreamTrack.State.ENDED);
audioTrack = null;
audioSource = null;
if(videoTrack != null && ActivityCall.callTypeGlobal.equals(CallManager.CallType.VIDEO)){
Log.d("TestCallType",String.valueOf(ActivityCall.callTypeGlobal));
mediaStream.removeTrack(videoTrack);
videoTrack = null;
source.stop();
videoCapturer.dispose();
videoCapturer = null;
activeCamera = null;
Log.d("TestCallType","Video Track"+String.valueOf(videoTrack));
Log.d("TestCallType","Video Capturer"+String.valueOf(videoCapturer));
}
mediaStream = null;
}
查看源代码(如果这不是存储库,我确信这是基于错误行号使用的类)导致异常的行是这样的:
assertTrue(audioRecord.getRecordingState()
== AudioRecord.RECORDSTATE_RECORDING)
确保在通话结束后释放您使用的所有内容。当一个新的调用开始时,每个资源都需要是新的。并重新初始化。