webrtc-native-build
webrtc-native-build copied to clipboard
Native build of Google's webrtc library.
webrtc-native-build
Native build of Google's webrtc library. The library is also packaged with BoringSSL and libyuv.
- WebRTC is a standard for real-time audio/video/data communication and is mostly used in web browsers.
- BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.
- libyuv is an open source project that includes YUV scaling and conversion functionalities.
License
By default, libwebrtc is built with non-free codecs. To build without them, change the following flags in generate_ninja_files.bash and generate_ninja_files.bat.
rtc_use_h264=false
proprietary_codecs=false
ffmpeg_branding="Chromium"
Dependencies (Linux)
sudo apt-get install ninja-build cmake build-essential libssl-dev libboost-all-dev
sudo apt-get install libglib2.0-dev libgtk-3-dev libpulse-dev libasound2-dev
# For cross compiling
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
Dependencies (Mac)
# XCode and homebrew must be installed first.
brew install ninja
Building
# Create build directory
mkdir build
# Go to build directory
cd build
# Run CMake with arguments
cmake ../ [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_BUILD_ARCHITECTURE=arm32|arm64|amd64|win64|osx64]
# Parallel build
make -j
# will copy to dist directory
make install
Building on Windows
Building on Windows is not supported yet for recent versions of WebRTC.
You can submit a PR to help with this if you wish.
If you want to build on Windows, you can use the tag 4389.e7d9f7.130.
There is also a prebuilt version of the library available in the releases section on GitHub.
Dependencies
- Ninja
- Copy
ninja.exein3rdParty/webrtc_native/
- Copy
- CMake
- Git
- Python
- MSVC 2022 Build Tools
- Windows SDK 10.0.20348.0 (make sure that it is checked while installing MSVC)
- Windows SDK Debugging Tools
- Navigate to
Control Panel->Programs->Programs and Features - Right-click on
Windows Software Development Kit, and chooseChange - Select
Changeand clickNext - Check the box for
Debugging Tools for Windowsand clickChangeMake sure to checkAdd to PATHfor everything you install
- Navigate to
Setup
- Create a copy of your
<python_dir>/python.exeexecutable as<python_dir>/python3.exe. - Make sure that
python,python3,cmakeandgitare in your path. - Make sure the registry entry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem::LongPathsEnabledis set to0x1 - Launch a
CMDprompt as Administrator, and executegit config --system core.longpaths true
Building
Using a CMD prompt (not tested with powershell or git-bash or any other shell)
# Create build directory
mkdir build
# Go to build directory
cd build
# Run CMake with arguments
cmake .. -G "Ninja" [-DCMAKE_BUILD_TYPE=Release|Debug]
# Parallel build
ninja
# Copy to dist directory
ninja install
# Generate a zip archive in build/
ninja package
Important notes
- You might have trouble building if your system is not in English
- You might have trouble building if the full path to
python.exehas at least one space in it
Consuming the library
On Windows, you will have to link any target that consumes this library to these additional Windows libraries:
secur32winmmdmoguidswmcodecdspuuidmsdmostrmiidsiphlpapi
If you don't link against these libraries, your linker might see missing symbols like these ones:
__imp_timeGetTime__imp_timeKillEvent__imp_timeSetEvent__imp_timeBeginPeriod__imp_timeEndPeriodCLSID_CWMAudioAECIID_IMediaObjectIID_IMediaBufferMoInitMediaTypeMoFreeMediaTypeInitializeSecurityContextAAcquireCredentialsHandleA__imp_FreeCredentialsHandleCompleteAuthToken__imp_DeleteSecurityContext
How to use a new version?
- Fetch WebRTC Code
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
- Find the new
branch-head-number- Open Chrome
- Open the following URL chrome://settings/help
- The new
branch-head-numberis the third number of the version (Version 120.0.6099.109 -->branch-head-number= 6099)
- Find the commit hash
git checkout branch-heads/<branch-head-number>
git rev-parse HEAD
- Update the version (see the next section)
- Update the hash and version in the CMakeList.txt file
- Update the VERSION file
Versioning Scheme
branch-head-number.first-6-digits-of-webrtc-commit-hash.patch-number
To find the patch-number for a given branch-head-number, use the following web page:
https://chromium.googlesource.com/chromium/src/+/branch-heads/<branch-head-number>/chrome/VERSION
Dropped support
MacOS 10.15 Catalina
GitHub Actions dropped support for MacOS 10.15 Catalina.
However, the latest tag might still work to build under MacOS 10.15.
There are also prebuilt versions of the library available in the releases section on GitHub, for tag version 5039.5df5b1.1 and earlier.
Authors
- Marc-Antoine Maheux (@mamaheux)
- Dominic Létourneau (@doumdi)
- Philippe Warren (@philippewarren)
License
- Apache License, Version 2.0
Sponsor

IntRoLab - Intelligent / Interactive / Integrated / Interdisciplinary Robot Lab