配置好科学上网环境
1、下载depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
2、将depot_tools加入环境变量
3、运行gclient
4、新建webrtc源码目录
fetch --nohooks webrtc
gclient sync
5、切换到目标分支,如m99
git checkout -b m99 refs/remotes/branch-heads/4844
gclient sync
Win vs2019编译
gn gen ../out --ide=vs2019
6、设置环境变量
# 设置vs2019环境变量,可以直接设置到系统环境变量
set GYP_MSVS_VERSON=2019
set GYP_GENERATORS=msvs-ninja,ninja
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
# 编译vs2019 release:
gn gen out --ide=vs2019
ninja -C out
注:
1)如果用vs2019打开编译all.sln,设置并行编译数为1
2)如果提示未安装debug tools,打开控制面板,修改对应版本SDK的安装,勾选debug tools
3)M87以后的版本存在peerconnection_client OnConnected不回调的问题,如果要跟踪调试代码,可以切换到M87。Debug 模式下M87 peerconnetion_client运行崩溃。修改src\modules\video_capture\windows\sink_filter_ds.cc
STDMETHODIMP CaptureInputPin::Receive()
{
//RTC_DCHECK_RUN_ON(&capture_checker_);
}
Android 编译:
需要Ubuntu x86环境
前述第四步改为
fetch --nohooks webrtc_android
gclient sync
5、安装编译依赖
cd src
./build/install-build-deps.sh
./build/install-build-deps-android.sh
6、编译
gn gen out/Debug --args='target_os="android" target_cpu="arm"'
ninja -C out/Debug