Closed jmillan closed 1 year ago
Do we need these before/after logs permanently? I assume we don't once we know how it works.
I see this on my machine (Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
) and OPENSSL_ia32cap value is the same emitted by the openssl
command:
mediasoup:Channel [pid:458297] DepLibUV::PrintVersion() | libuv version: "1.44.2" +0ms
mediasoup:Channel [pid:458297] DepOpenSSL::operator()() | openssl version: "OpenSSL 3.0.8 7 Feb 2023" +0ms
mediasoup:Channel [pid:458297] DepOpenSSL::operator()() | openssl CPU info before init: "CPUINFO: OPENSSL_ia32cap=0x7ffaf3bfffebffff:0x40000018029c67af" +0ms
mediasoup:Channel [pid:458297] DepOpenSSL::operator()() | openssl CPU info after init : "CPUINFO: OPENSSL_ia32cap=0x7ffaf3bfffebffff:0x40000018029c67af" +0ms
So it seems the caps are loaded without the need to call OPENSSL_init_ssl()
.
Still we are not 100% sure HW encryption is being used.
I'm keeping this PR open for a while just for discussion.
Please, see the Edit
section of the issue description. We have an easy way to know if HW encryption is being used.
I've kept just a single log line in this PR showing the CPU info, which I'll commit. I've removed the OpenSSL initialization as it seems it's not needed.
It's difficult to know if we are using HW acceleration for encrypting SRTP.
In theory we are. We are compiling
libsrtp
withopenssl
so the first makes use of HW capabilities of the second. I've realised that it is by callingOPENSSL_init_ssl()
that the corresponding capability bits are filled, which are used for hardware encryption.I've added two logs, before and after
openssl
initialization which show the CPU info. In my casearm64
I have the same values:Which shows like the CPU capability bits are already filled even before calling
OPENSSL_init_ssl()
. So perhaps calling this method is not needed.@vpalmisano, I know you played with
openssl
in the past. Do you have any opinion about this? Anyone?I'd like to know if we are using HW capabilities in
libsrtp
.NOTE: I've made a local performance tests. Using HW capabilities makes a great difference:
With HW capabilities:
Without HW capabilities:
EDIT:
In order to know if
libsrtp
is making use of HW encryption start the media server with the corresponding ENV variable and without it, and start a router with many video consumers. Ie:This will disable the capabilities for arm64, change the name to
OPENSSL_ia32cap
for an intel CPU.In my case, disabling the HW capabilities takes twice as much CPU on a arm64 (Mac M1)