2

Previously I used org.webrtc:google-webrtc:1.0.26885 and it was fine, now I switched to the newest version 1.0.27225. I used the method createPeerConnection of PeerConnectionFactory in 26885 version to create a PeerConnection instance and it worked ok, but after I switched to the newest version 27225, the method createPeerConnection always returns null. Could someone help me resolve this problem?

The room server is from: https://github.com/webrtc/apprtc, The Signal server is collider and from apprtc/src/collider, The NAT server is from https://github.com/coturn/coturn. All of the android client code is from https://github.com/Piasy/webrtc/tree/hack_webrtc/examples/androidapp/src/org/appspot/apprtc.

    PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(signalingParameters.iceServers);
    // TCP candidates are only useful when connecting to a server that supports
    // ICE-TCP.
    rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED;
    rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE;
    rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;
    rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;

    // Use ECDSA encryption.
    rtcConfig.keyType = PeerConnection.KeyType.ECDSA;
    // Enable DTLS for normal calls and disable for loopback calls.
    rtcConfig.enableDtlsSrtp = !peerConnectionParameters.loopback;
    rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;

    peerConnection = factory.createPeerConnection(rtcConfig, pcObserver);

1 Answers1

3

I had the same issue. Fixed by changing ICE server url from turn:login@127.0.0.1:8080?transport=tcp to turn:127.0.0.1:8080?transport=tcp. Also you can enable webrtc logging to see what's going wrong: https://webrtc.org/native-code/logging/

Victor Shpyrka
  • 232
  • 3
  • 10