如何冰重启? [英] how to ice restart?

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

问题描述

我正在使用 android libjingle 开发基于 webRTC 的语音聊天 app.我想在用户更改时使用 ice restart 重新连接用户他们的网络从 wifi 到 4g,反之亦然,或者已断开连接.我有一个关于使用 libjingle 实现它的问题.我将根据我的理解写下如何实现冰重启功能,以便让我知道有什么问题.

I am developing a voice chatting app based on webRTC using android libjingle.I want to reconnect users by using ice restart when they change their network from wifi to 4g or vice versa, or are disconnected. I have a question about implementing it by using libjingle. I will write down how to implement ice restart function based on what I understood so let me know there is anything wrong.

问:据我所知,首先我需要在 MediaConstraints 选项中将 ice start 选项设置为 true,而不删除用于第一次连接的对等连接 객체 如下所示:

Q: As I understand, at first I need to set ice start option to be true in the MediaConstraints option without removing peer connection 객체 used for the first connection like below:

mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));

其次,我需要使用对等连接 객체(用于第一次连接)的 updateIce 方法更新 MediaConstrants,如下所示:

Secondly, I need to update MediaConstrants using the peer connection 객체(used for the first connection)'s updateIce method like below:

peerConnection.updateIce(iceServers, mediaConstraints);

最后发送一个offer是否正确,这与基本的webrtc网络相同吗?

And finally is it right to send an offer, which is the same with basic webrtc network?

  • 我想再次确认我是否理解得很好.如果我写的有什么不对的地方,请告诉我!!

推荐答案

为了进行 ice restart,发送方应该发送不同的 ice-pwd 或 ice-ufrag 的 SDP 文件.IceRestart 选项强制 PeerConnection 更新这些值.

For doing ice restart, sender should send SDP file with different ice-pwd or ice-ufrag. IceRestart option forces PeerConnection to update those values.

步骤应该是:

  1. 附加约束:<代码>cons.mandatory.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));
  2. 生成sdp文件:<代码>pc.createOffer(new WebRtcObserver(callbacks), cons);
  3. 将结果 sdp 设置为 PeerConnection:<代码>pc.setLocalDescription(new WebRtcObserver(callbacks), sdp);
  4. 将其发送给远程对等方.

因此第 2-4 步与常规报价相同.

So steps 2-4 are the same as for regular offer.

这篇关于如何冰重启?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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