Native Webrtc如何禁用PeerConnection的DataChannel加密

问题描述 投票:0回答:1

我目前正在一个项目中努力为旧游戏Supreme Commander构建通信适配器。此通信适配器使用本机webrtc。该项目是Forged Alliance Forever,这是通信适配器的repositoy:github.com/FAForever/ice-adapter

通信适配器当前正在使用加密通信,但我们希望禁用加密。上传带宽是许多参与者的游戏中的限制因素,DTLS会增加每条消息的开销。这些消息的大小约为20-50字节。因此,DTLS头和填充的开销很重要。

所以问题是:是否可以使用本机webrtc版本68禁用PeerConnection的DataChannel加密?

如果是这样,怎么样?你有一个很小的例子吗?

我尝试了以下方法(对不起代码片段):

在选项中创建PeerConnectionFactory并禁用加密:

_pcfactory = webrtc::CreateModularPeerConnectionFactory(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
webrtc::PeerConnectionFactoryInterface::Options webRtcOptions;
webRtcOptions.disable_encryption = true;
_pcfactory->SetOptions(webRtcOptions);

使用enable rtp数据通道创建PeerConnection:

webrtc::PeerConnectionInterface::RTCConfiguration configuration;
configuration.servers = _iceServerList;
configuration.enable_rtp_data_channel = true;
_peerConnection = _pcfactory->CreatePeerConnection(configuration,nullptr, nullptr, _peerConnectionObserverObj);

到目前为止,这是我测试过的。现在的问题是,回答方在channel.cc中产生了中止,所以也许我没有正确使用该接口。你有什么建议吗?

问候

encryption webrtc rtp
1个回答
0
投票

创建对等连接时,可以将DtlsSrtpKeyAgreement约束设置为false。但是,此选项可能很快就会从库中删除,请参阅qazxsw poi

但是必要的代码更改仍将保留在git中,因此您可以在编译库之前通过还原该更改来重新启用该选项。

© www.soinside.com 2019 - 2024. All rights reserved.