rptwsthi
rptwsthi

Reputation: 10172

WebRTC crash when I try to end a call (close connection)

In android implementation of WebRTC, I have checked multiple discussion all of those mention about unloaded .so files I have even tried using https://github.com/KeepSafe/ReLinker to keep hold on these .so file.

Here is crash log for the issue:

E/art: No implementation found for void org.webrtc.voiceengine.WebRtcAudioRecord.nativeDataIsRecorded(int, long) (tried Java_org_webrtc_voiceengine_WebRtcAudioRecord_nativeDataIsRecorded and Java_org_webrtc_voiceengine_WebRtcAudioRecord_nativeDataIsRecorded__IJ)
E/AndroidRuntime: FATAL EXCEPTION: AudioRecordJavaThread
              Process: app.lov.com.lov_android_app, PID: 23128
              java.lang.UnsatisfiedLinkError: No implementation found for void org.webrtc.voiceengine.WebRtcAudioRecord.nativeDataIsRecorded(int, long) (tried Java_org_webrtc_voiceengine_WebRtcAudioRecord_nativeDataIsRecorded and Java_org_webrtc_voiceengine_WebRtcAudioRecord_nativeDataIsRecorded__IJ)
                  at org.webrtc.voiceengine.WebRtcAudioRecord.nativeDataIsRecorded(Native Method)
                  at org.webrtc.voiceengine.WebRtcAudioRecord.access$600(WebRtcAudioRecord.java:26)
                  at org.webrtc.voiceengine.WebRtcAudioRecord$AudioRecordThread.run(WebRtcAudioRecord.java:90)
E/art: No implementation found for void org.webrtc.voiceengine.WebRtcAudioTrack.nativeGetPlayoutData(int, long) (tried Java_org_webrtc_voiceengine_WebRtcAudioTrack_nativeGetPlayoutData and Java_org_webrtc_voiceengine_WebRtcAudioTrack_nativeGetPlayoutData__IJ)

Upvotes: 2

Views: 2000

Answers (2)

grebulon
grebulon

Reputation: 7972

According to the bug reported here and here, it seems that you need to create the peerConnectionFactory only once. Each time it is created it tries to create an audio device module, but only one is supported on Android.

Also (if using MediaSoup) make sure you create only a single Device and free it when done.

Upvotes: 0

rptwsthi
rptwsthi

Reputation: 10172

Many thanks to Dhilip from https://stackoverflow.com/a/30803727/656600. His solution on his own question(about objective C) helped me. I am quoting his suggestion here:

I was trying to create PeerConnectionFactory and LocalVideoTrack in worker thread! Problem solved when I moved those to main thread.

Based on that suggestion I updated my code to:

Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
    peerConnectionClient.createPeerConnectionFactory(getActivity(),peerConnectionParameters, this);
});

This fixed the crash for me. I am still looking for explanation on this. So please add details if you know.

Upvotes: 1

Related Questions