I am implementing webrtc in android using libjingle (version-9127), the issue is that in one application life cycle when I try to make calls, then the first call is successfully established and then ended. But when second call is made then when the call gets pickup then , the video is displayed , but audio stream is not transferred and then after 3-7 sec the app crashes giving this error. The complete logcat error is below:
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: To disconnect the call I have made this code. Hope you can figur out what the error is. After this I am releasing 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;
}