2

以前我用 org.webrtc:google-webrtc:1.0.26885 很好,现在我切换到最新版本 1.0.27225。我在26885版本中使用PeerConnectionFactory的createPeerConnection方法创建了一个PeerConnection实例,它工作正常,但是在我切换到最新版本27225之后,方法createPeerConnection总是返回null。有人可以帮我解决这个问题吗?

房间服务器来自:https ://github.com/webrtc/apprtc,Signal服务器来自collider,来自apprtc/src/collider,NAT服务器来自https://github.com/coturn/coturn。所有的 android 客户端代码都来自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);
4

1 回答 1

3

我遇到过同样的问题。通过将 ICE 服务器 url 从turn:login@127.0.0.1:8080?transport=tcp更改为turn:127.0.0.1:8080?transport =tcp 来修复。您还可以启用 webrtc 日志记录以查看发生了什么问题:https ://webrtc.org/native-code/logging/

于 2019-08-22T07:24:00.407 回答