Simplest WebRtc Debugging Development Environment For Linux

All in All WebRtc

A Step by Step Guide to ** Compile, Build & Debug** WebRTC Library for Linux OS within 10 minutes.

I have been working with WebRtc and its associated technologies since Jan 2018. I got the motivation to plan a series of blogs about WebRtc research in the simplest way such that fresh candidates can easily understand WebRtc firsthand. When I started working with WebRtc, things weren’t straightforward to understand for such a huge C/C++ stack that comprises a lot of the fields on a single platform. It is being said;

WebRtc is a kind of playground for any kind of Developer and Engineer from different fields of research and development such as Digital Signal Processing, Applied Sciences, Networking, and VoIP.

Please Visit: To Develop WebRtc Library For Android

Today, I am going to present a very simple and explanatory example of a WebRtc debugging environment for Linux OS in the following steps;

  • WebRtc Compilation for Linux Box/OS
  • Testing WebRtc Default Examples
  • Create a Simple WebRtc Example with Clion

Example WebRtc Project: Simple WebRtc Cpp Program For Linux


This tutorial assumes that you are on a UNIX-based system, I am on Ubuntu and have tested versions *18.04 LTS* and *20.04 LTS*.

Note: I recommend WebRtc Linux development on Ubuntu 18.04 LTS

WebRtc Compilation for Linux Box/OS:

I have made simple and straightforward steps of WebRtc Compilation.

Strictly Recommended: Don’t Open Multiple Terminal Tabs/Windows to install any dependencies related to WebRTC Prerequisites. Do Every of Your Task Related to WebRTC in One and Only One Terminal’s Tab/Window.

First of all, make sure the following things have already been installed, if not then use these commands to do that:

- sudo add-apt-repository ppa:openjdk-r/ppa
- sudo apt-get install openjdk-8-jdk
- sudo apt-get install pkg-config
- sudo apt-get update
OR Simply Inline Command;sudo add-apt-repository ppa:openjdk-r/ppa && sudo apt-get install openjdk-8-jdk && sudo apt-get install pkg-config && sudo apt-get update

Some additional Libraries;

- sudo apt update
- sudo apt install libboost-all-dev
- sudo apt-get install -y nlohmann-json-dev
- sudo apt install libwebsocketpp-dev

Let’s kick start compiling WebRtc for Linux OS to set up a development environment. Start the following steps one by one. Every step takes its own time based on the *machine specs* and *internet speed*, so make sure every step is completed without interruption.

1- git clone

2- export PATH=”$PATH:${HOME}/depot_tools”

3- mkdir webrtc_linux

3.1- cd webrtc_linux

4- fetch — nohooks webrtc_linux

5- gclient sync

6- cd src/

7- ./build/

8- git branch -r

9- git checkout origin/master

# To check you’re in origin/master branch
10- git branch
# To generate project files using the defaults (Debug build), run (standing in the src/ directory of your checkout):11- gn gen out/Debug — args=’is_debug=false is_component_build=false is_clang=false rtc_include_tests=false rtc_use_h264=true rtc_enable_protobuf=false use_rtti=true use_custom_libcxx=false treat_warnings_as_errors=false use_ozone=true’# When you have Ninja project files generated (see previous section), compile (standing in src/) using:12- ninja -C out/Debug

It turns out that you will end up with the compilation and building of libwebrtc.ain the /webrtc_linux/src/out/Debug/obj/ directory. Now you can use this WebRtc Static Library in your project to develop and debug WebRtc Native C++ Stack;

Testing WebRtc Default Examples:

Once you have successfully compiled the WebRtc library for Linux, then initially you can test the WebRtc generated small programs to verify that your compilation process is 100%accurate;

Just go to this directory: /webrtc_linux/src/out/Debug/

Here you will see a list of test programs to observe the basic and simple implementation of the WebRtc native stack;

  • Green Colored Files are WebRtc Test Programs

To run any program, simply use the following command for any of the programs; Make sure you are in this directory: /webrtc_linux/src/out/Debug/

Terminal Tab-A

- ./peerconnection_server

Terminal Tab-B

- ./peerconnection_client # Peer-A

Terminal Tab-C

- ./peerconnection_client # Peer-B

The result on Tab-A:

By using the same technique, you can test other compiled programs as well. At this point, we are very confident that our WebRtc compiled libs are 100% accurate.

Create a Simple WebRtc Example with Clion:

Now, we will build a simple CPP program based on **CMake**. You can use an IDE of your own choice, but for this tutorial, I am using CLion IDE for CPP development and debugging.

Create a simple CPP based project or simply clone this project's example from Github; Simple WebRtc Cpp Program For Linux

Program CMakeLists.txt File:

Here is the CMakeLists.txt file of our program:

CMakeLists.txt File

Now, we have to implement main.cpp file that will include the WebRtc program basic logic; Here is the reference file;

main.cpp File

The reference to other files that are being used in this sample program is available in this Github repo; Simple WebRtc Cpp Program For Linux.

Now, when you simply build the project, it will successfully compile. The resultant output of the program in debug mode is as follows;

The resultant output of the program in console mode is as follows;

When you run this program, you will come up with the following list of commands to generate SDPs and ICE Candidates

*** Welcome to WebRtc Debugging Development Environment ***
> Please follow these commands to use this program <
1. sdp1 -> To Generate SDPs for Peer-A
2. sdp2 -> To Generate SDPs for Peer-B
3. ice1 -> To Generate Ice Candidates for Peer-A
4. ice2 -> To Generate Ice Candidates for Peer-B
5. ; -> To terminate RTC Thread Session.

Resultant output at the console:

When you type sdp1 command, the result will be like this;

:140071081162560:Main thread has initiated...
> sdp1
> :140071046182656:CreateSessionDescriptionObserver::OnSuccess
Offer sdp:begin
o=- 1381929178758113972 2 IN IP4
t=0 0
a=group:BUNDLE data
a=msid-semantic: WMS
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4
a=fingerprint:sha-256 10:0B:68:35:3F:20:65:48:0D:67:7E:DF:3F:2A:4F:ED:A1:CE:79:CF:D8:B1:AE:D0:57:59:BB:C6:4A:DD:91:8C
Offer sdp:end

When you type ice1 command, the output will be like this;

> ice1
"candidate": "candidate:1021689336 1 udp 2122260223 44302 typ host generation 0 ufrag Zw7U network-id 3 network-cost 50",
"sdp_mid": "data",
"sdp_mline_index": 0
"candidate": "candidate:1919303944 1 tcp 1518280447 53703 typ host tcptype passive generation 0 ufrag Zw7U network-id 3 network-cost 50",
"sdp_mid": "data",
"sdp_mline_index": 0
"candidate": "candidate:3182279500 1 udp 1686052607 44302 typ srflx raddr rport 44302 generation 0 ufrag Zw7U network-id 3 network-cost 50",
"sdp_mid": "data",
"sdp_mline_index": 0


I have tried my best to cut this tutorial as simple as possible to give newbies a good example to Kick starts the *WebRtc debugging* across core Linux development. Thanks for your support.




Senior WebRTC Architect | Unreal Engine & WebRtc Algorithm Engineer | Senior Research Scientist | Pythoneer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Journal 01 — First Setup of Git with Unity

How To Fix BLU Studio X12 Not Charging [Troubleshooting Guide]

Domain Driven Design, Version Control and Crypto Currency

Writing generic file reader in Rust

Use OVH floating IP for outgoing traffic, including from containers

Custom AWS Amplify Auth Storage

Make Complex Things Understandable

Create glassmorphism using html and css

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Muhammad Usman Bashir

Muhammad Usman Bashir

Senior WebRTC Architect | Unreal Engine & WebRtc Algorithm Engineer | Senior Research Scientist | Pythoneer

More from Medium

How To Make Writing Unit Tests Easier

What the Heck is a Merkle Tree?

.NET vs Java: Which One Should You Go For?

OAuth 2.0: A Comprehensive Guide