RTCPeerConnection.setRemoteDescription closing the app without any error
See original GitHub issuei was calling RTCPeerConnection.setRemoteDescription(recievedOffer) just after RTCPeerConnection.createOffer() on other side. but RTCPeerConnection.setRemoteDescription was closing app abruptly without even any error.
Expected behavior
it should be able to set remote description successfully or it should throw error in react native app instead of closing app
Observerd behavior
It closing the app abruptly.
Steps to reproduce the problem
CODE
createAnswer = async (remoteDes) => { try { console.log(‘setting up create answer’, remoteDes); // this line closing the app abruptly await this.localPC.setRemoteDescription(remoteDes); console.log(‘createAnswer => set local description’); const answer = await this.localPC.createAnswer(); console.log(
createAnswer from remotePC: ${remoteDes.sdp}
); await this.localPC.setLocalDescription(answer); console.log(‘createAnswer, setRemoteDescription’); fObj.sendMsgForVideoCall( {cid: this.state.myID, localDescription: this.localPC.localDescription}, ‘answer’, ); } catch (err) { console.error(Error while offering ${err}
); } };`
Error from androind emulator
09-02 10:57:40.415 2121 2280 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method ‘java.lang.String java.lang.String.toUpperCase(java.util.Locale)’ on a null object reference 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at org.webrtc.SessionDescription$Type.fromCanonicalForm(SessionDescription.java:34) 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at com.oney.WebRTCModule.WebRTCModule.peerConnectionSetRemoteDescriptionAsync(WebRTCModule.java:811) 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at com.oney.WebRTCModule.WebRTCModule.lambda$peerConnectionSetRemoteDescription$17$WebRTCModule(WebRTCModule.java:800) 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at com.oney.WebRTCModule.-$$Lambda$WebRTCModule$hxPcRQaZtSAbYntTvH4jzT2Ocgk.run(Unknown Source:8) 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 09-02 10:57:40.415 2121 2280 E AndroidRuntime: at java.lang.Thread.run(Thread.java:923) 09-02 10:57:40.417 2121 2121 I org.webrtc.Logging: EglRenderer: Initializing EglRenderer 09-02 10:57:40.418 512 2706 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
- React Native version: 0.64.2
- react-native-webrtc version: 1.92.1
- OS: Android
- OS version:
Issue Analytics
- State:
- Created 2 years ago
- Comments:26 (11 by maintainers)
Top GitHub Comments
After a closer look it’s apparent that there’s something weird in the library. Have a look at the constructor of RTCSessionDescription. It expects an “info” object with type as null.
Later on in peerConnectionSetRemoteDescription (WebRTCModule.java file for android) a session description object is attempted to be constructed with this code:
This can never work since the getString will always assert cause the type is constructed as null. Not sure why the type is set to null during construction.
a quick fix is to set the type to what you want right after constructing an RTCSessionDescription object with e.g.
answerDescription._type = 'answer'
@yehyaumar can u explain more? Thanks