如何解决不可靠的WebRTC调用? [英] How to fix unreliable WebRTC calling?

查看:166
本文介绍了如何解决不可靠的WebRTC调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WebRTC调用在我们的应用程序中不可靠.有时我们看到黑屏,有时根本看不到呼叫开始,有时音频/视频出现巨大的延迟或不同步.

WebRTC calls are not reliable in our application. Sometimes we see the black screen, sometimes we don’t see call start at all and sometimes there are seen huge delays or de-sync in audio/video.

设置:

  • Google’s public STUN server stun:stun.l.google.com:19302;
  • TURN server is Coturn hosted in azure in docker;
  • Signaling server is a customized https://github.com/andyet/signalmaster that using express as a web server
  • On client JS is used, with simplewebrtc as client;
  • For iOS support used Cordova plugin - https://github.com/eface2face/cordova-plugin-iosrtc

几乎 100%复制的问题是从LTE上的一个客户端呼叫到Wi-Fi上的另一个客户端.在这种情况下,我们在两个设备上都看到黑屏,但是,默认的bg-color是白色,因此至少在WebRTC端发生了某些事情.

Almost 100% reproduced issue is calling from one client on LTE to another on Wi-Fi. In this case we see black screen on both devices, however, default bg-color is white, so at least something happens on WebRTC side.

解决问题的方法:

  • 检查过的Coturn日志...有时我们在这里看到未经授权"的错误,但是很难说它们是否有影响;
  • 检查了Coturn的流量:在从Wi-Fi到Wi-Fi的情况下,流量很低,因此确实建立了对等连接.如果有LTE,我们会看到大约40–120KiB/sec的负载(对于音频/视频来说这不是太低吗?),所以TURN似乎可以工作;
  • 已检查的客户端应用日志,没什么特别的;

请提出任何可能的研究或修复方法,以使WebRTC尽可能可靠.

推荐答案

上述方案来自本文有关此主题的很多细节.

The above scheme is from this article I wrote which goes into a lot of detail on this topic.

很快,问题可能会出现在这三个步骤中的任何一个步骤中:

Shortly, problems can appear in any of the 3 steps:

  1. 发信号
  2. 使用STUN/TURN发现
  3. p2p连接

这就是我要做的:

  1. 在320x240之类的约束条件中使用较低的最低分辨率,这将确保没有简单的方法来避免 getUserMedia ()错误
  2. 确保通过端口80或443完成信令
  3. 在许多情况下,对等体无法与STUN/TURN服务器进行通讯,因此请尝试使用TCP(stun:stun.l.google.com:19302?transport=tcp)和端口80(默认为UDP端口3478或19302)与STUN/TURN通信Google的STUN,它们可能被您的路由器/防火墙/代理/移动网络阻止了)
  4. 使用 TrickleICE (通过您自己的STUN/TURN)和LTE/WiFi设备上的 WebRTC疑难解答,您将学到很多关于它们如何操作的信息被连接到
  1. Use a low minimum resolution in constraints like 320x240, this will make sure there are no simple to avoid getUserMedia() errors
  2. Make sure signaling is done over port 80 or 443
  3. In many cases a peer can not communicate with the STUN/TURN servers so try communicating with STUN/TURN using TCP (stun:stun.l.google.com:19302?transport=tcp) and port 80 (default is UDP port 3478 or 19302 for Google's STUN and they might be blocked by your router/firewall/proxy/mobile network )
  4. Use TrickleICE (with your own STUN/TURN) and the WebRTC Troubleshooter on the LTE/WiFi devices and you'll learn a lot about how they can be connected to

这篇关于如何解决不可靠的WebRTC调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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