WebRTC Domestic Acceleration Mirror and Compilation Guide
This article explains the background, principles, and step‑by‑step instructions for using a non‑intrusive domestic mirror to accelerate WebRTC dependency synchronization and compilation across macOS, iOS, Linux, Android, and Windows platforms, including proxy configuration and repository URL replacement.
Project Background
During the construction of Xueersi's low‑latency interactive live‑streaming network, frequent compilation of WebRTC is required. Because WebRTC has many dependencies (tens of gigabytes) and most resources are behind the Great Firewall, setting up the development environment often takes several days, especially for newcomers.
WebRTC uses Google's version control and build tools, with complex and dynamically downloaded dependencies. After analyzing the dependency graph and trying various acceleration methods, a non‑intrusive mirror solution was found.
We share this mirror to help the community compile WebRTC more efficiently.
Principle
WebRTC dependencies are divided into three categories:
Git‑hosted source code (about 30 repositories). We sync these to a GitLab mirror because GitHub imposes size limits. The mirror updates every ten minutes to stay in sync with Google source.
CIPD modules hosted on appspot.com, which are mirrored via an HTTP proxy.
Large assets stored in Google Cloud Storage, also accessed through an HTTP proxy.
During synchronization, Git code is pulled from the corresponding GitLab repositories, while the parts that are hard to mirror are fetched through the provided HTTP proxy.
Mirror Description
No modifications to the original WebRTC source.
Synchronizes with the upstream code every ten minutes.
Compilation Steps
Replace Git repository URLs
git config --global url.https://gitlab.com/webrtc-mirror/webrtc.git.insteadOf https://chromium.googlesource.com/external/webrtc.git
git config --global url.https://gitlab.com/webrtc-mirror/base.git.insteadOf https://chromium.googlesource.com/chromium/src/base
git config --global url.https://gitlab.com/webrtc-mirror/build.git.insteadOf https://chromium.googlesource.com/chromium/src/build
git config --global url.https://gitlab.com/webrtc-mirror/buildtools.git.insteadOf https://chromium.googlesource.com/chromium/src/buildtools
git config --global url.https://gitlab.com/webrtc-mirror/gradle.git.insteadOf https://chromium.googlesource.com/external/github.com/gradle/gradle.git
git config --global url.https://gitlab.com/webrtc-mirror/ios.git.insteadOf https://chromium.googlesource.com/chromium/src/ios.git
git config --global url.https://gitlab.com/webrtc-mirror/testing.git.insteadOf https://chromium.googlesource.com/chromium/src/testing
git config --global url.https://gitlab.com/webrtc-mirror/third_party.git.insteadOf https://chromium.googlesource.com/chromium/src/third_party
git config --global url.https://gitlab.com/webrtc-mirror/clang-format.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format.git
git config --global url.https://gitlab.com/webrtc-mirror/libcxx.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/libcxx.git
git config --global url.https://gitlab.com/webrtc-mirror/libcxxabi.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git
git config --global url.https://gitlab.com/webrtc-mirror/libunwind.git.insteadOf https://chromium.googlesource.com/external/llvm.org/libunwind.git
git config --global url.https://gitlab.com/webrtc-mirror/android_ndk.git.insteadOf https://chromium.googlesource.com/android_ndk.git
git config --global url.https://gitlab.com/webrtc-mirror/android_tools.git.insteadOf https://chromium.googlesource.com/android_tools.git
git config --global url.https://gitlab.com/webrtc-mirror/auto.git.insteadOf https://chromium.googlesource.com/external/github.com/google/auto.git
git config --global url.https://gitlab.com/webrtc-mirror/catapult.git.insteadOf https://chromium.googlesource.com/catapult.git
git config --global url.https://gitlab.com/webrtc-mirror/compact_enc_det.git.insteadOf https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git
git config --global url.https://gitlab.com/webrtc-mirror/colorama.git.insteadOf https://chromium.googlesource.com/external/colorama.git
git config --global url.https://gitlab.com/webrtc-mirror/depot_tools.git.insteadOf https://chromium.googlesource.com/chromium/tools/depot_tools.git
git config --global url.https://gitlab.com/webrtc-mirror/errorprone.git.insteadOf https://chromium.googlesource.com/chromium/third_party/errorprone.git
git config --global url.https://gitlab.com/webrtc-mirror/ffmpeg.git.insteadOf https://chromium.googlesource.com/chromium/third_party/ffmpeg.git
git config --global url.https://gitlab.com/webrtc-mirror/findbugs.git.insteadOf https://chromium.googlesource.com/chromium/deps/findbugs.git
git config --global url.https://gitlab.com/webrtc-mirror/freetype2.git.insteadOf https://chromium.googlesource.com/chromium/src/third_party/freetype2.git
git config --global url.https://gitlab.com/webrtc-mirror/harfbuzz.git.insteadOf https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git
git config --global url.https://gitlab.com/webrtc-mirror/gtest-parallel.git.insteadOf https://chromium.googlesource.com/external/github.com/google/gtest-parallel
git config --global url.https://gitlab.com/webrtc-mirror/googletest.git.insteadOf https://chromium.googlesource.com/external/github.com/google/googletest.git
git config --global url.https://gitlab.com/webrtc-mirror/icu.git.insteadOf https://chromium.googlesource.com/chromium/deps/icu.git
git config --global url.https://gitlab.com/webrtc-mirror/jsr-305.git.insteadOf https://chromium.googlesource.com/external/jsr-305.git
git config --global url.https://gitlab.com/webrtc-mirror/jsoncpp.git.insteadOf https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git
git config --global url.https://gitlab.com/webrtc-mirror/junit.git.insteadOf https://chromium.googlesource.com/external/junit.git
git config --global url.https://gitlab.com/webrtc-mirror/fuzzer.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/compiler-rt/lib/fuzzer.git
git config --global url.https://gitlab.com/webrtc-mirror/libjpeg_turbo.git.insteadOf https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git
git config --global url.https://gitlab.com/webrtc-mirror/libsrtp.git.insteadOf https://chromium.googlesource.com/chromium/deps/libsrtp.git
git config --global url.https://gitlab.com/webrtc-mirror/libvpx.git.insteadOf https://chromium.googlesource.com/webm/libvpx.git
git config --global url.https://gitlab.com/webrtc-mirror/libyuv.git.insteadOf https://chromium.googlesource.com/libyuv/libyuv.git
git config --global url.https://gitlab.com/webrtc-mirror/linux-syscall-support.git.insteadOf https://chromium.googlesource.com/linux-syscall-support.git
git config --global url.https://gitlab.com/webrtc-mirror/mockito.git.insteadOf https://chromium.googlesource.com/external/mockito/mockito.git
git config --global url.https://gitlab.com/webrtc-mirror/nasm.git.insteadOf https://chromium.googlesource.com/chromium/deps/nasm.git
git config --global url.https://gitlab.com/webrtc-mirror/openh264.git.insteadOf https://chromium.googlesource.com/external/github.com/cisco/openh264
git config --global url.https://gitlab.com/webrtc-mirror/requests.git.insteadOf https://chromium.googlesource.com/external/github.com/kennethreitz/requests.git
git config --global url.https://gitlab.com/webrtc-mirror/robolectric.git.insteadOf https://chromium.googlesource.com/external/robolectric.git
git config --global url.https://gitlab.com/webrtc-mirror/ub-uiautomator.git.insteadOf https://chromium.googlesource.com/chromium/third_party/ub-uiautomator.git
git config --global url.https://gitlab.com/webrtc-mirror/usrsctp.git.insteadOf https://chromium.googlesource.com/external/github.com/sctplab/usrsctp
git config --global url.https://gitlab.com/webrtc-mirror/binaries.git.insteadOf https://chromium.googlesource.com/chromium/deps/yasm/binaries.git
git config --global url.https://gitlab.com/webrtc-mirror/patched-yasm.git.insteadOf https://chromium.googlesource.com/chromium/deps/yasm/patched-yasm.git
git config --global url.https://gitlab.com/webrtc-mirror/tools.git.insteadOf https://chromium.googlesource.com/chromium/src/tools
git config --global url.https://gitlab.com/webrtc-mirror/client-py.git.insteadOf https://chromium.googlesource.com/infra/luci/client-py.git
git config --global url.https://gitlab.com/webrtc-mirror/boringssl.git.insteadOf https://boringssl.googlesource.com/boringssl.gitInstall depot_tools
export WORKSPACE=$(pwd)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$WORKSPACE/depot_tools:$PATHConfigure HTTP/HTTPS Proxy
// HTTP and HTTPS proxy service; may be unstable, report issues if needed
// Do not abuse this proxy; a blacklist will be applied later
export http_proxy=http://39.105.13.136:8080
export https_proxy=http://39.105.13.136:8080Sync WebRTC Source
gclient config --name src https://chromium.googlesource.com/external/webrtc.git
gclient syncCompile WebRTC
macOS
cd src
// optional additional build arguments
gn gen out/mac --args='is_debug=false target_cpu="x64" rtc_include_tests=false rtc_build_tools=false rtc_build_examples=false'
// mac_framework_objc is a framework; other targets can be used
ninja -C out/mac mac_framework_objciOS
cd src
python tools_webrtc/ios/build_ios_libs.py --output-dir out/ios --arch arm64 --extra-gn-args rtc_include_tests=false rtc_build_tools=false rtc_build_examples=falseLinux
cd src
// install dependencies
bash build/install-build-deps.sh
gn gen out/linux --args='is_debug=false target_cpu="x64" rtc_include_tests=false rtc_build_tools=false rtc_build_examples=false'
ninja -C out/linuxAndroid (must be built on Linux)
# Add Android platform
echo "target_os = [ 'android' ]" >> .gclient
gclient sync
cd src
// install Android dependencies
./build/install-build-deps-android.sh
python tools_webrtc/android/build_aar.py --build-dir out/android --arch armeabi-v7a --extra-gn-args rtc_include_tests=false rtc_build_tools=false rtc_build_examples=falseWindows
gn gen out/Win --args='proprietary_codecs=true is_debug=false target_cpu="x86" ffmpeg_branding="Chrome" rtc_include_tests=false'
ninja -C out/WinClear HTTP/HTTPS Proxy After Build
export http_proxy=''
export https_proxy=''Notes
Testing files are disabled to speed up download and compilation; therefore add rtc_include_tests=false to the build arguments.
Proxy traffic is filtered to allow only WebRTC‑related domains, conserving bandwidth.
Final
We are also recruiting WebRTC talent to build real‑time interactive audio‑video products for the education sector. Interested candidates can send their resumes to [email protected] .
Xueersi Online School Tech Team
The Xueersi Online School Tech Team, dedicated to innovating and promoting internet education technology.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.