WebRTC lives in the renderer process, and all receiving and sending of UDP data is done through Mojo IPC, for security reasons. For normal media, the network throughput is generally quite limited (a HD stream is typically a few MBps), but WebRTC also have a concept called "Data Channels", which is a peer-to-peer general purpose socket - similar to TCP.
The issue we're facing is that the throughput on that DataChannel socket is quite low, and CPU limited. On my Macbook, it's limited to 12MB/s to another tab (i.e: No actual network sending) and uses ~100% CPU, and I can get to 20MB/s on my high performance Linux desktop.
Doing a pprof[1] shows that a large part of this time is spent in Mojo, with IPC serialization. The pprof shown here highlights the sending - receiving also has the same overhead.
My question: Is there another way that this can be done more efficiently? Reading the docs seems to indicate that one could perhaps pass shared memory buffers instead?
The rationale is that applications that use DataChannels - even with low throughput - are experiencing too high CPU usage, and also that Chrome can't saturate the actual network bandwidth, which it's suppose to be able to do.
Any ideas other comments are also welcome,
Thanks,
Victor