WebRTC setLocalDescription not trigger ICE Gather Event

45 views Asked by At

I am writing a webrtc application, when i use WebRTC as a callee, receive from anther call maybe pstn, jsSIP create answer to setLocalDescrption, but not tigger the ICE gather event, so webRTC not get the ice candidate; who know this, thanks!!!

Is there something else I have to do in order to make it work ?

1

There are 1 answers

0
mindlesswaisty On

In my case, the reason was that I had copied some tutorial code:

private fun buildPeerConnectionFactory(): PeerConnectionFactory {
    return PeerConnectionFactory
        .builder()
        .setVideoDecoderFactory(DefaultVideoDecoderFactory(rootEglBase.eglBaseContext))
        .setVideoEncoderFactory(DefaultVideoEncoderFactory(rootEglBase.eglBaseContext, true, true))
        .setOptions(PeerConnectionFactory.Options().apply {
            disableEncryption = true
            disableNetworkMonitor = true
        })
        .createPeerConnectionFactory()
}

Changing it to the below fixed it for me:

private fun buildPeerConnectionFactory(): PeerConnectionFactory {
    return PeerConnectionFactory
        .builder()
        .setVideoDecoderFactory(DefaultVideoDecoderFactory(rootEglBase.eglBaseContext))
        .setVideoEncoderFactory(DefaultVideoEncoderFactory(rootEglBase.eglBaseContext, true, true))
        .createPeerConnectionFactory()
}

I also added

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

to my manifest