Janus WebRTC Gateway on CentOS 6

WebRTC is an exciting innovation that enables Real-Time Communications (both HD audio and video) using just a browser. Last week I looked at Janus – a general puporse WebRTC gateway developed by Meetecho. The demo’s show the power of WebRTC and are definitely worth a look.

Currently the IETF’s latest WebRTC Audio Codec and Processing Requirements draft states that the client is required to support Opus for audio. This means that if you want to stream audio from a WebRTC server to a client, the server will need to be able to do so using the Opus audio codec. And that’s where things get interesting.

Trying to build Janus on CentOS 6.5 x86_64 I bumped into several issues:

1) Janus requires a newer glib than available on CentOS 6
2) Janus requires a newer libnice than available on CentOS 6
3) Janus requires the Opus plugin in GStreamer

Here’s how it went:

Janus requires a newer glib than available for CentOS 6

Since glib is part of CentOS 6 ‘base’ it’s a bad idea to just create a RPM package of a newer glib and replace the existing one. Even if there was no issue with replacing base RPMs it would still require a rebuild of all the RPMs that depend on glib. And that’s a lot of RPMs meaning rebuilding large parts of CentOS. So I looked into creating an RPM of the required glib with the autotools stuff patched to create a non-conflicting namespace. After spending way too much time in the Autotools rabbit hole I decided to just create static glib libs and link Janus against those static libs.

Janus requires a newer libnice than available for CentOS 6

Similar to glib I decided to create static libnice libs and link Janus against those static libs.

Linking static and dynamic libs

With the glib and libnice libs statically compiled I went on to build Janus. While building went well, linking failed consistently. After way too much time staring at linking failures and trying to figure out why it was failing to link, I found out that there is some GCC linker voodoo required if you want to link to both static and dynamic libraries. The simplified version is:

Once I added that and figured out in which order the libs needed to be listed I finally had a Janus executable:

Janus requires the Opus plugin in GStreamer

CentOS 6 has gstreamer-plugins-bad-free version 0.10.19 which does not contain the Opus plugin. So I figured I just rebuild it with the Opus plugin enabled and stick the Opus plugin in a separate package so it does not interfere with gstreamer-plugins-bad-free from ‘base’. That sounded like a good idea until I found out that gstreamer-plugins-bad-free version 0.10.19 did not even contain the Opus plugin. The first version to get the Opus plugin is gstreamer-plugins-bad-free version 0.10.23 which happens to be shipped with CentOS 7. So I decided to take the Opus plugin code from the 0.10.23 release and add it to the 0.10.19 release resulting in one big patch adding everything including the autotools part. Unfortunately the GStreamer developers decided to introduce a new API with the 0.10.23 release. Since that code is not present in the 0.10.19 release the Opus plugin can not be compiled unless that API is backported which is not part of my skillset.

Close but no sigar

In hindsight I should have looked just deep enough at each issue to see if there were any deal breakers. The lack of a Gstreamer Opus plugin on EL6 means that at least Janus can not be used on EL6. And since Opus is an audio requirement for WebRTC there are probably other WebRTC projects that are challenging to deploy on EL6. And that’s not even taking into account the required VP8 and other video codecs. WebRTC is shiny new technology with shiny new requirements. If you are planning a WebRTC Proof of Concept, investigate all possible issues and jump straight to EL7.

Retry on CentOS 7

Once I have access to a CentOS 7 build environment I will revisit Janus and share the results.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.