为什么 webrtc Ice Candidate 类型与两个对等连接不同

问题描述

我在网络浏览器 (chrome) 和 Android 应用程序之间建立了对等连接。 当我查询统计信息以检查两个对等点之间的连接类型时。我猜信息应该是一样的,但是我看到两个结果是不同的。

谁能给我解释一下?

安卓版

boolean success = peerConnection.getStats(statsReports -> {
    for (StatsReport report : statsReports) {
         Log.i(TAG,"report " + report.toString());
    }
},null);

android 上的结果(我手动过滤了 Conn-audio 文件)

[googLocalAddress: 192.168.123.13:47063],[localCandidateId: Cand-b6zAa+KI],[googLocalCandidateType: local],[googRemoteAddress: 192.168.123.49:50663],[remoteCandidateId: Cand-2rJUPD95],[googRemoteCandidateType: local],

在网络浏览器(chrome)中

const reqFields = [
  'googLocalAddress','googLocalCandidateType','googRemoteAddress','googRemoteCandidateType'
];
const connectionDetails = {};
peerConnection.getStats(stats => {
  // console.log("peer starts",stats.result());
  const filtered = stats.result().filter(e => {
    return e.id.indexOf('Conn-audio') === 0 && e.stat('googActiveConnection') === 'true';
  })[0];
  if (!filtered) return resolve({});

  reqFields.forEach(e => {
    connectionDetails[e.replace('goog','')] = filtered.stat(e);
  });
  console.log('1111111',connectionDetails);
});

网络浏览器结果

LocalAddress: "192.168.123.49:50663"
LocalCandidateType: "local"
RemoteAddress: ":47063"
RemoteCandidateType: "prflx"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...