Libwebrtc is open source, how hard can it be.

Recent discussions with several parties, make me realise that the first steps to master webrtc are not yet documented enough. Once, as a challenge,...

Recent discussions with several parties, make me realize that the first steps to master webrtc are not yet documented enough. Once, as a challenge, I asked a master student doing his graduation project with us to try to recompile and example provided with libwebrtc separately from the compilation of libwebrtc itself. Basically to make a project with the same example source code but that would link against the pre-compiled library. 5 months later, it was still not successful. Thanks to our internal tool that I shared then, we eventually did it in two weeks. This post is about the usual ordeal people have to go through to understand the state of affair, and of course how CoSMo can shield you from that.

libwebrtc from webrtc.org

libwebrtc, the Implementation behind Chrome, Firefox, Safari, Edge and many other’s WebRTC API, is the de facto standard implementation for WebRTC compliant clients.

Unfortunately, libwebrtc is one of a kind. Designed to be fully integrated in the chromium build and test process, it includes some feature that help 1,000 developper strong team remaining agile, but that goes on the way of the usual practice for smaller teams:

  • no design document,
  • no backward compatibility,
  • no stable release, only sync’ed release,
  • specific (undocumented) build tool chain,
  • build tool design that requires everything to be build in one pass,
  • 200 commits a week
  • no assurance of commit stability
  • lack of updated examples except for those which are shipped along

As a result, the usual experience with libwebrtc goes like this:

  1. The golden path [3 ~ 5 days]
  2. go to webrtc.org,
  3. figure out the exact development environement needed (esp on windows),
  4. get the code sync’ed for a specific revision,
  5. compile it,
  6. test with appRTC or peerconnection_client.
  7. Emancipation: try to compile your own project and link against libwebrtc [weeks]
  8. Simplest way: take out the source code of peerconnection_user and try to compile it separately
  9. Deal with include paths,
  10. Deal with C++ standard (98,11,14, 17),
  11. Deal with C++ standard implementation lib mismatch,
  12. Deal with missing preprocessor definitions (WEBRTC_WIN, WEBRTC_POSIX, …),
  13. Deal with missing JSON symbols,
  14. Eventually succeed in barely reproducing something that was already working.
  15. Starting to deviate from the golden path: the quest for GN GEN args
  16. Try to make your own capturer, needs rtti,
  17. add support for H264,
  18. add support for ccache,
  19. add cupport for cross-compilation (ios, android),

all of the above, and some more, deviate from the official build, but has existing, undocumented flags for them.

  1. Alone in deep water
  2. Any modification to the C++ code,
  3. Changing external libs (OpenSSL, libsrtp, …),
  4. Adding a new codec,
  5. Compiling for an unsupported platform (win32 for IE plugin, …),
  6. Compiling the C++ API for arm64 (for Qt, …),

All of the above are quite reasonable things to do, but still excrutiating hard to do in libwebrtc.

  1. the final blow: the ever recurring 6 weeks deadline

Once all of this has been figured out, you have a version of your app linkind against libwebrtc (or yo ugave up already). And then, chrome releases a new version, which breaks backward compatibility, which makes your app basically unusable … Since libwebrtc is not a simple single git repository, but an aggregated collection of them, rebasing is not an option.

In a less critical scenario, nothing breaks, but you do not benefit from the bug fixes, improvements and new features the 20+ companies, including 120 google engineers, added to the source code since last release.

CoSMo Tools for easier webrtc

libwebrtc packages

We provide pre-compiled, packaged versions of libwebrtc, so you can focus on your app.

  • All the operating systems supported by webrtc.org are supported,
  • All libraries needed in addition of libwebrtc are packaged along,
  • CMake configuration files are provided to deal with compatibility:
  • check your compiler and build tool for compability,
  • set up all include and lib paths,
  • set compiler flags,
  • set preprocessor Definitions,
  • The builds are tested first using the google’s own unit test suite,
  • Then additionnal battery of tests which compile full applications are run,
  • Finally, we run those application against web app in browsers for interoperability tests thanks to KITE,

Advanced packages and tools

We provide customized builds of libwebrtc with different options, e.g.

  • Real end-to-end encryption (a.k.a. double encryption),
  • Watermarking,
  • G.729, H.265, AV1,
  • Custom Crypto (custom OpenSSL and libsrtp),
  • …,

We provide bindings and wrappers for webrtc into popular client libraries to make it even easier for you to use libwebrtc. not need to understand threading models, or COM models. Moreover, an update of libwebrtc itself would be transparent to the wrappers.

  • Qt wrappers, desktop and mobile,
  • Electron builds,
  • React Native,
  • IE 11 plugin,
  • …,

Full white label apps and single server Systems

We maintain a suite of white labels apps that work either p2p or with an SFU, with a given signalling server. It feeds our test suite, and is the perfect starting point for Proof-of-concepts.

  • appRTC, p2p connection, web app + native app desktop and mobile,
  • Janus Video Room, SFU connections, web app + Electron + Qt app + Mod. OBS-Studio,
  • Meedoze, SFU connection, web app + Electron + native all platforms + Qt app + Mod. OBS-Studio,
  • Jitsi, SFU connection, web app + Electron + react-native ios and android,

Do not hesitate to contact us for help and pricing!

Other Blog Posts