vaka
vaka

Reputation: 33

Native Webrtc how to disable encryption for DataChannel of PeerConnection

I am currently working on within a project which is trying to build a communication adapter for the old game Supreme Commander. This communication adapter uses native webrtc. The project is Forged Alliance Forever and this is the repositoy for the communication adapter: github.com/FAForever/ice-adapter

The communication adapter is currently working with encrypted communication, but we would like to disable encryption. Upload Bandwidth is a limiting factor in games with many participants and DTLS adds overhead to each message. Those messages have a little size of around 20-50 bytes. Therefore overhead of the DTLS header and padding are significant.

So here is the question: Is it possible to disable encryption for the DataChannel of a PeerConnection using the native webrtc release 68?

If so, how? Do you have a minimal example?

I tried the following things (sorry for code snippets):

Create PeerConnectionFactory and disable encryption in the options:

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

Create the PeerConnection with enable rtp data channel:

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

This is so far what I have tested. The problem is now, that the answerer side produces an abort in channel.cc, so maybe i did not use the interface correctly. Do you have any suggestions?

Regards

Upvotes: 1

Views: 1816

Answers (1)

seb
seb

Reputation: 316

You can set the DtlsSrtpKeyAgreement contraint to false when creating the peerconnection. However, this option may be removed soon from the library, see https://bugs.chromium.org/p/chromium/issues/detail?id=804275

but the neccessary code changes will remain in git anyways, therefore you can re-enable that option by reverting that change before compiling the library.

Upvotes: 1

Related Questions