1、设置git
git config --global http.proxy http://127.0.0.1:21882
git config --global https.proxy https://127.0.0.1:21882
git config --global http.postBuffer 1048576000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999 //一定要设置超时时间
2、设置vpn
set http_proxy=127.0.0.1:21882
set https_proxy=127.0.0.1:21882
3、设置vs编译
set vs2019_install=D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
set GYP_MSVS_OVERRIDE_PATH=D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
set WINDOWSSDKDIR=C:\Program Files (x86)\Windows Kits\10
# 以上三个环境变量,就算有空格,也不需要使用双引号,否则会报错
set GYP_GENERATORS=msvs-ninja,ninja
# 告诉depot_tools使用我们本机的VS进行编译
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
4、下载源码
下载depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc #下载约10G的内容,漫长的等待,网络不好的情况下会重试几次
gclient sync
5、切换分支
git checkout -b m99 refs/remotes/branch-heads/4844
gclient sync
5、编译
cd src
#开启 h264 编码支持
gn gen --ide=vs2022 --args="proprietary_codecs=true rtc_use_h264=true is_clang = true rtc_include_tests=false " out/Default
gn gen --ide=vs2022 out/Default
ninja -C out/Default #编译十几分钟