Android Studio App Crash with setRemoteDescription & SEGV_MAPERR

158 views
Skip to first unread message

טוהר כנר

unread,
Oct 25, 2023, 11:49:02 AM10/25/23
to discuss-webrtc

Dear WebRTC Support,

I hope this message finds you well. I am experiencing a consistent application crash in my Android Studio project when using the setRemoteDescription method from the WebRTC library. I am hoping to get some insight or assistance in resolving this issue.

Problem Description:

Upon invoking peerConnection.setRemoteDescription(sdpObserver, offer);, the app crashes with the following segfault: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40 in tid 16873 (worker_thread -), pid 16797 (xample.medicare)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40
Cause: null pointer dereference this is the full crash description upon my logcat :  libc                    com.example.medicare                 A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40 in tid 21853 (worker_thread -), pid 21781 (xample.medicare)
2023-10-24 14:58:05.855 21863-21863 crash_dump32            pid-21863                            I  obtaining output fd from tombstoned, type: kDebuggerdTombstone
2023-10-24 14:58:05.857   284-284   tombstoned              tombstoned                           I  received crash request for pid 21853
2023-10-24 14:58:05.858 21863-21863 crash_dump32            pid-21863                            I  performing dump of process 21781 (target tid = 21853)
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  Build fingerprint: 'google/sdk_gphone_x86/generic_x86_arm:11/RSR1.201013.001/6903271:user/release-keys'
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  Revision: '0'
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  ABI: 'x86'
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  Timestamp: 2023-10-24 11:58:05+0000
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  pid: 21781, tid: 21853, name: worker_thread -  >>> com.example.medicare <<<
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  uid: 10165
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A  Cause: null pointer dereference
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A      eax def51a70  ebx ba8a3f04  ecx ece6d880  edx def51a01
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A      edi b4254bc0  esi 00000000
2023-10-24 14:58:05.863 21863-21863 DEBUG                   pid-21863                            A      ebp b4254c18  esp b4254ba0  eip ba73a427
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A  backtrace:
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #00 pc 0089a427  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #01 pc 0089a305  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #02 pc 008912ba  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #03 pc 008966e8  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #04 pc 00450be0  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #05 pc 00452782  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #06 pc 0044f903  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #07 pc 0047ee7e  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.864 21863-21863 DEBUG                   pid-21863                            A        #08 pc 0044da0a  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #09 pc 0044d9dd  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #10 pc 004ebf80  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #11 pc 004ec565  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #12 pc 004eba6e  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #13 pc 004eb2a1  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #14 pc 004ea3ad  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #15 pc 004eb6cd  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #16 pc 004eb60c  /data/app/~~G0dQ5y7UqvSWIhbc-V1xng==/com.example.medicare-_vvhck4K3KWusj_6Y-EUMg==/base.apk!libjingle_peerconnection_so.so (offset 0x1f01000) (BuildId: 43700aba2764442a)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #17 pc 000e6974  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+100) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
2023-10-24 14:58:05.865 21863-21863 DEBUG                   pid-21863                            A        #18 pc 00078567  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71) (BuildId: 6e3a0180fa6637b68c0d181c343e6806) Relevant Code: I've initialized the PeerConnectionFactory and created a peerConnection as follows: PeerConnectionFactory.InitializationOptions initializationOptions =
            PeerConnectionFactory.InitializationOptions.builder(context)
                    .createInitializationOptions();
PeerConnectionFactory.initialize(initializationOptions);
peerConnectionFactory = PeerConnectionFactory.builder().createPeerConnectionFactory();

// ...

if (peerConnection == null) {
    PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
    peerConnection = peerConnectionFactory.createPeerConnection(rtcConfig, new CustomPeerConnectionObserver("peerConnection") {});
    // ...
}
When attempting to set the remote description, I use the following code: SessionDescription offer = new SessionDescription(SessionDescription.Type.OFFER, sdp);
if (offer != null) {
    try {
        CustomSdpObserver sdpObserver= new CustomSdpObserver("setRemoteDescription");
        peerConnection.setRemoteDescription(sdpObserver, offer);
        System.out.println(5);
    }
    catch (Exception e){
        System.out.println(e);
    }
}
SDP Value: v=0 o=- 1698146779722261 1 IN IP4 35.89.245.77 s=Mountpoint 6452728803529504 t=0 0 a=group:BUNDLE a v d a=ice-options:trickle a=fingerprint:sha-256 86:F3:FD:0A:85:34:FD:C6:07:47:77:06:35:EB:3A:56:B9:34:A3:BC:37:37:30:DF:F4:0D:F2:4B:61:A4:9F:75 a=extmap-allow-mixed a=msid-semantic: WMS * m=audio 9 UDP/TLS/RTP/SAVPF 111 c=IN IP4 35.89.245.77 a=sendonly a=mid:a a=rtcp-mux a=ice-ufrag:lYJL a=ice-pwd:pJe9IQ0fqHLAcgwIIglaiA a=ice-options:trickle a=setup:actpass a=rtpmap:111 opus/48000/2 a=rtcp-fb:111 transport-cc a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid a=msid:janus janusa a=ssrc:567261543 cname:janus a=candidate:1 1 udp 2015363327 35.89.245.77 57864 typ host a=candidate:2 1 udp 1679819007 35.89.245.77 57864 typ srflx raddr 172.18.0.4 rport 57864 a=end-of-candidates m=video 9 UDP/TLS/RTP/SAVPF 100 101 c=IN IP4 35.89.245.77 a=sendonly a=mid:v a=rtcp-mux a=ice-ufrag:lYJL a=ice-pwd:pJe9IQ0fqHLAcgwIIglaiA a=ice-options:trickle a=setup:actpass a=rtpmap:100 VP8/90000 a=rtcp-fb:100 ccm fir a=rtcp-fb:100 nack a=rtcp-fb:100 nack pli a=rtcp-fb:100 goog-remb a=rtcp-fb:100 transport-cc a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid a=rtpmap:101 rtx/90000 a=fmtp:101 apt=100 a=ssrc-group:FID 370355824 3619095706 a=msid:janus janusv a=ssrc:370355824 cname:janus a=ssrc:3619095706 cname:janus a=candidate:1 1 udp 2015363327 35.89.245.77 57864 typ host a=candidate:2 1 udp 1679819007 35.89.245.77 57864 typ srflx raddr 172.18.0.4 rport 57864 a=end-of-candidates m=application 9 UDP/DTLS/SCTP webrtc-datachannel c=IN IP4 35.89.245.77 a=sendrecv a=mid:d a=sctp-port:5000 a=ice-ufrag:lYJL a=ice-pwd:pJe9IQ0fqHLAcgwIIglaiA a=ice-options:trickle a=setup:actpass a=candidate:1 1 udp 2015363327 35.89.245.77 57864 typ host a=candidate:2 1 udp 1679819007 35.89.245.77 57864 typ srflx raddr 172.18.0.4 rport 57864 a=end-of-candidates iceServers:

size=4 0:[stun:stun.kinesisvideo.us-west-2.amazonaws.com:443] [:] [TLS_CERT_POLICY_SECURE] [] [null] [null] 1:[turn:54-218-169-180.t-ae7dd61a.kinesisvideo.us-west-2.amazonaws.com:443?transport=udp] [1698148615:djE6YXJuOmF3czpraW5lc2lzdmlkZW86dXMtd2VzdC0yOjg5OTAxNjUwOTUyMDpjaGFubmVsL3RhbGtzLXN0cmVhbWVyLXByb2QtMjAvMTY3NzE2OTkyNTQxNA==:/WYW3d/nrxtFMVMQ8cLEdIu8dc6+8Osvj64GU0ONvRk=] [TLS_CERT_POLICY_SECURE] [] [null] [null] 2:[turns:54-218-169-180.t-ae7dd61a.kinesisvideo.us-west-2.amazonaws.com:443?transport=udp] [1698148615:djE6YXJuOmF3czpraW5lc2lzdmlkZW86dXMtd2VzdC0yOjg5OTAxNjUwOTUyMDpjaGFubmVsL3RhbGtzLXN0cmVhbWVyLXByb2QtMjAvMTY3NzE2OTkyNTQxNA==:/WYW3d/nrxtFMVMQ8cLEdIu8dc6+8Osvj64GU0ONvRk=] [TLS_CERT_POLICY_SECURE] [] [null] [null] 3:[turns:54-218-169-180.t-ae7dd61a.kinesisvideo.us-west-2.amazonaws.com:443?transport=tcp] [1698148615:djE6YXJuOmF3czpraW5lc2lzdmlkZW86dXMtd2VzdC0yOjg5OTAxNjUwOTUyMDpjaGFubmVsL3RhbGtzLXN0cmVhbWVyLXByb2QtMjAvMTY3NzE2OTkyNTQxNA==:/WYW3d/nrxtFMVMQ8cLEdIu8dc6+8Osvj64GU0ONvRk=] [TLS_CERT_POLICY_SECURE] [] [null] [null] The peerConnection object is initialized, with the following details: peerConnection: {peerConnection@19188}
nativePeerConnection: -1124735024 Additional Information:

I've ensured that the peerConnection object is initialized before calling setRemoteDescription. I've also tried to handle any exceptions that might occur during this operation, but it seems to be an underlying issue causing the null pointer dereference.

I'd greatly appreciate any assistance or insights you might offer in resolving this issue. If additional details or clarifications are needed, please let me know.

Thank you for your time and support.

Warm regards.


Jakob Wonisch

unread,
Nov 19, 2024, 7:53:11 AM11/19/24
to discuss-webrtc
I have had a similar issue and managed to solve it using the following:

VideoDecoderFactory decoderFactory = new DefaultVideoDecoderFactory(rootEglBase.getEglBaseContext());

 peerConnectionFactory = PeerConnectionFactory.builder()
                .setOptions(options)
                .setVideoDecoderFactory(decoderFactory)
                .createPeerConnectionFactory();

It appears that webrtc sometimes can't find any decoders at all and crashes when trying to create a media stream using a decoder. The same can be done for encoders but is not necessary if you only want to receive a stream.

Hope that helps somebody!
Reply all
Reply to author
Forward
0 new messages