windows webrtc 开发环境搭建

下载 安装depot tools

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

depot_tools依赖python2.7

git代理设置:

	git config --global http.proxy http://127.0.0.1:1080
	git config --global https.proxy https://127.0.0.1:1080

取消代理设置

	git config --global --unset http.proxy
	git config --global --unset https.proxy

gclient代理设置:

	set https_proxy=http://localhost:1080 
	set http_proxy=http://localhost:1080 

**注意:**https_proxy 不要设置成https://localhost:1080,否则会报下列错误:

RPC failed transiently. Will retry in 1s
{“error”:“failed to send request: Post https://chrome-infra-packages.appspot.co
m/prpc/cipd.Repository/ResolveVersion: dial tcp 75.126.2.43:443: connectex: A co
nnection attempt failed because the connected party did not properly respond aft
er a period of time, or established connection failed because connected host has
failed to respond.”, “host”:“chrome-infra-packages.appspot.com”, “method”:“Reso
lveVersion”, “service”:“cipd.Repository”, “sleepTime”:“1s”}

代码拉取

设置:set DEPOT_TOOLS_WIN_TOOLCHAIN=0 (调用gn的时候也需要设置这个变量)

作用:“Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to use a google-internal version).”

mkdir webrtc-checkout
cd webrtc-checkout

Windows

fetch --nohooks webrtc
gclient sync

生成vs工程

set DEPOT_TOOLS_WIN_TOOLCHAIN=0

cd src
gn gen out/Default –ide=vs2019

查看编译参数,可以把它保存到文件,方便查看

gn args out/Default --list
gn args out/Default --list > gn_param_list.txt

修改编译参数,修改后再查看是否成功

gn gen out/Default -ide=vs2019 --args="is_debug=true is_component_build=true target_cpu=\"x86\" use_rtti=true is_clang=false rtc_build_tools=false rtc_include_tests=false rtc_build_examples=false"
gn args out/Default --list

支持H264编码

设置参数:

gn gen out/Default -ide=vs2019 --args="rtc_use_h264=true proprietary_codecs=true"

参数说明:

rtc_use_h264,这个开关控制了是否使用 H264 (对应C++代码中的宏 WEBRTC_USE_H264);

在 webrtc/webrtc.gni 文件中定义:

rtc_use_h264 = proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)

proprietary_codecs 在 build/config/features.gni 中定义:

proprietary_codecs = is_chrome_branded || is_chromecast

默认windows下proprietary_codecs 为fasle,所以没有打开

VS打开工程

进入out\Default目录,用VS打开all.sln文件

工程打开失败错误**“对COM组件的调用返回了错误HRESULT E_FAIL”**解决办法:

1.以管理员身份打开 Developer Command Prompt for VS 2019(vs2019开发人员命令提示符)
2.定位到你的vs2019的安装目录
例:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies
先输入cd c: 切换到c盘 再cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies
3.执行下面的代码
gacutil -i Microsoft.VisualStudio.Shell.Interop.12.0.dll

分支切换

通过https://chromiumdash.appspot.com/releases?platform=Windows查看 stable或beta版,获取版本号74.0.3729.169

git tetch --tags  
git checkout -b branch_heads_3729_m74 74.0.3729.169
gclient sync --with_branch_heads --with_tags

猜你喜欢

转载自blog.csdn.net/tanlovezhao/article/details/106528584