ICE candidates gathered only from one network interface

帅比萌擦擦* 提交于 2021-02-11 13:35:34

问题


Got very simple code:

<script type="text/javascript">
    pc = new window.RTCPeerConnection();

    pc.onicecandidate = function(event) {
        console.log("onicecandidate\n", event);
    }

    pc.onicegatheringstatechange = function(event) {
        console.log("onicegatheringstatechange\n", event);
    }

    dc = pc.createDataChannel("dataChannel");

    errFunc = function(err) {
        console.log("errFunc\n", err);
    }

    successCback = function() {
        console.log("setLocalDescription is a success\n");
    }

    pc.createOffer()
        .then(function(offer) { pc.setLocalDescription(offer)})
        .then(successCback)
        .catch(errFunc);

</script>

Got ubuntu running chromium and TWO local ethernet interfaces. Running aforementioned code yields only 1 call to onicecandidate and 1 call to onicegatheringstatechange. (any STUN/TURN servers are deliberately not specified, so I do expect only local host candidates, but from all interfaces). Only one ethernet interface is examined by ICE.

Why ?


回答1:


Unless you have permissions for getUserMedia, Chrome will restrict ICE candidates to the interface of the default route. The rationale is explained in this draft



来源:https://stackoverflow.com/questions/52664279/ice-candidates-gathered-only-from-one-network-interface

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!