我使用libjingle(版本-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)
修改:要断开调用,我已经创建了此代码。希望你能弄明白错误是什么。在此之后我发布了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;
}
答案 0 :(得分:0)
查看source code(如果那不是存储库,我确定您根据错误行号码使用的是该类)该行导致异常的是:
assertTrue(audioRecord.getRecordingState()
== AudioRecord.RECORDSTATE_RECORDING)
确保在通话结束后释放您使用的所有内容。当新的呼叫开始时,每个资源都需要新鲜。然后重新初始化。