ICE 候选人仅从一个网络接口收集 [英] ICE candidates gathered only from one network interface

查看:29
本文介绍了ICE 候选人仅从一个网络接口收集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

得到非常简单的代码:

让 ubuntu 运行铬和两个本地以太网接口.运行上述代码只会产生 1 调用 onicecandidate 和1 调用 onicegatheringstatechange.(故意不指定任何 STUN/TURN 服务器,所以我只希望本地主机候选,但来自所有接口).ICE 只检查一个以太网接口.

为什么?

解决方案

除非你有 getUserMedia 的权限,否则 Chrome 会将 ICE 候选者限制在默认路由的接口上.在本草案

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 ?

解决方案

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

这篇关于ICE 候选人仅从一个网络接口收集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆