android - LAN 上的 Android WebRTC:仅将候选 127.0.0.1 发送到信令服务器
问题描述
我正在尝试创建一个基于 WebRTC 的 Android 视频聊天应用程序,以部署在本地网络上。设置很简单:2 个 Android 终端和一个 Linux 服务器在同一个本地网络(以太网)上。没有 STUN 也没有 TURN 服务器。只有主机候选者和一个信令服务器(HTTP+WS)。
几年前,我在 GitHub 上发现了一个基于 libjingle-9127的 Android 应用程序,以及相关的 Node.js 服务器。我的设置开箱即用。
这个库已有 4 年历史,我尝试迁移到最新的 google-webrtc Android SDK + appr.tc 服务器的 Node.js 端口。信号效果很好,但视频聊天本身失败了。
尝试比较两个版本,我意识到发送到信令服务器的候选列表是:
- 每个带有 libjingle 版本的网络接口一个候选者
- google-webrtc 版本只有 127.0.0.1 和 :::1
这似乎是由于中间引入了一种称为Trickle ICE的 WebRTC 机制。而且我不知道如何配置 WebRTC 来声明与我的本地网络接口相对应的候选人。
是否有 WebRTC Android SDK 的 API 可以让我这样做?
谢谢!
PS:发送到信令服务器的候选列表。
使用 libjingle-9127
{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:2316705582 1 udp 2122260223 192.168.237.1 34869 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:2316705582 1 udp 2122260223 192.168.237.1 34869 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:2316705582 1 udp 2122260223 192.168.237.1 34869 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:3614478314 1 udp 2122194687 172.17.84.124 52163 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:3614478314 1 udp 2122194687 172.17.84.124 52163 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:1846788752 1 udp 2122129151 172.17.116.134 45915 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:1846788752 1 udp 2122129151 172.17.116.134 45915 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:13699457 1 udp 2122063615 10.11.239.176 51039 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:13699457 1 udp 2122063615 10.11.239.176 51039 typ host generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:3298157534 1 tcp 1518280447 192.168.237.1 36295 typ host tcptype passive generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:3298157534 1 tcp 1518280447 192.168.237.1 36295 typ host tcptype passive generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:2582868762 1 tcp 1518214911 172.17.84.124 44376 typ host tcptype passive generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":1,"id":"video","candidate":"candidate:2582868762 1 tcp 1518214911 172.17.84.124 44376 typ host tcptype passive generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
,{"type":"candidate","payload":{"label":0,"id":"audio","candidate":"candidate:546324064 1 tcp 1518149375 172.17.116.134 41308 typ host tcptype passive generation 0"},"from":"-Dl0-BWMLUwmKvvcAAAD"}]
使用 google-webrtc-1.0.26405
03-15 18:29:47.008 2318 2347 D RoomRTCClient: GAE->C #1 : {"type":"candidate","label":0,"id":"0","candidate":"candidate:1510613869 1 udp 2121932543 127.0.0.1 58474 typ host generation 0 ufrag rhKZ network-id 4"}
03-15 18:29:47.009 2318 2347 D RoomRTCClient: GAE->C #2 : {"type":"candidate","label":0,"id":"0","candidate":"candidate:559267639 1 udp 2122005759 ::1 46169 typ host generation 0 ufrag rhKZ network-id 5"}
解决方案
推荐阅读
- haskell - Haskell, Aeson - (ToJSON ByteString) 没有实例
- javascript - 如何调整画布内容的大小并获取调整大小(和压缩)的图像 base64 数据?
- c++ - 如何配置 CppCheck 以阻止函数的使用
- javascript - 通过单击将 div 的文本添加到列表中,并通过单击相同的 div 将其删除
- java - 为什么这段代码运行一段时间后总是什么也不打印?
- apache - 我们的应用程序中存在一个称为不安全传输的漏洞:弱 SSL 协议如何在 Apache 中解决此问题
- python - 使用 python pandas 分隔符或删除竖线
- node.js - 程序列表中的电子生成器应用程序名称,Windows 上没有版本
- c++ - “ReadFile 函数”有没有办法让我不再声明要读取的特定字节数?
- json - 如何在 GO 中将换行符转换为正确的 JSON?