download:
1. Since the webrtc source code is outside the wall, you need to go online scientifically (solve it by yourself). Of course, webrtc now has a domestic mirror address: https://webrtc.org.cn/mirror. Compilation and download tutorials are attached for self-checking (after downloading, only M79 and the latest master branch are included). Since personal projects require the M72 version, science Go online.
2. You need to install git (version 2.23.0.windows.1) on windows, then configure the environment variables, and then you need to use it in the "command prompt"
3. Download depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
After downloading depot-tools, decompress it and set the decompression directory to the environment variable (PATH)
Add the following two items to the environment variable
DEPOT_TOOLS_WIN_TOOL_WIN_TOOLCHAIN = 0
4. Download the WebRTC source code
Create folder
$ mkdir webrtc_wins
$cd webrtc_src
Get the source code
$fetch --nohooks webrtc
$gclient sync
Position the branch to m72
$cd src
$git checkout -b m72 refs/remotes/branch-heads/72
$gclient sync
Compile
1. You need to configure the environment before compiling
Visual Studio Community 2017 version 15.9.15
The individual components that need to be installed are as follows:
Open cmd to set temporary environment variables
$set GYP_MSVS_OVERRIDE_PATH=D:\Program Files (x86)\Microsoft Visual Studio\2017\Community
$set DEPOT_TOOLS_WIN_TOOLCHAIN=0
$set GYP_GENERATORS=msvs-ninja,ninja
$set GYP_MSVS_VERSON=2017
$set DEPOT_TOOLS_UPDATE=0
Then execute:
$cd src
$gn gen out/Default --ide=vs2017
$ninja -C out/Default
Compile and support h264:
$gn gen out/Debug_h264 --args="is_component_build=false rtc_use_h264=true proprietary_codecs=true ffmpeg_branding=\"Chrome\"" --ide=vs2017
$ninja -C out/Debug_h264
Problems encountered:
Problem: gclient sync or fetch --nohooks webrtcmingl stuck or 443 timeout, it should be the proxy network is not set up
If there is no special requirement for the version, it is recommended to use webrtc domestic mirror
Solution: execute set http_proxy= http://127.0.0.1:1080
set https_proxy=https://127.0.0.1:1080
Then use curl to test the network of the relevant address
问题:Failed download_from_google_storage --no_resume --platform=win32 --no_auth
--bucket chromium-gn -s src/buildtools/linux32/gn.sha1
NOTICE: You have PROXY values set in your environment, but gsutil in
depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environment variable from
being used.
To use a proxy in this situation, please supply those settings in a .boto
file pointed to by the NO_AUTH_BOTO_CONFIG environment var.
Solution: Just find a place to generate a text file, such as D:\boto.cfg
Enter the following in the file (assuming the proxy server is http://http.proxy.com:1080):
[Vote]
proxy= http://http.proxy.com
proxy_port = 1080
Then set the environment variable
set NO_AUTH_BOTO_CONFIG=D:\boto.cfg
Execute gclient sync again
Problem: "UnicodeDecodeError:'ascii' codec can't decode byte 0xc0 in position 7: ordi" This problem is caused by installing both python2 and python3
Solution: execute python -m pip install --upgrade pip
Problem: The problem of using Win32api in Python to report an error, No module named win32file
Solution: pip install pypiwin32 or pip3 install pypiwin32 or python -m pip install pypiwin32
Problem: Webrtc compilation debug library call link error LNK2038: Detected mismatch of "_ITERATOR_DEBUG_LEVEL": value "0" does not match value "2" (in main.obj) error
Solution: add enable_iterator_debugging = true when compiling
Related parameter analysis:
Is_debug is the Debug version, the default is true, false: it means that the Release version is compiled.
target_os platform type, can take the value win, android, ios, linux, etc. Here win is used, which means Windows platform.
target_cpu cpu type, x86, x64 can be selected under Windows
Is_component_build uses dynamic runtime library, here is false, static runtime library is used, Release version will correspond to MT, Debug version will correspond to MTd.
Whether proprietary_codecs uses copyright encoding, that is, H264, here is true.
rtc_use_h264 Whether to use H264, set true here. Note that the Windows platform uses OpenH264 for encoding and ffmpeg for decoding.
ffmpeg_branding The branch name of ffmpeg, the branch of Chrome is used here.
is_clang Whether to compile with clang compiler, the default setting is true
Please refer to the webrtc.gni file in the src directory in the source code for the description of all compilation parameters
Welcome to follow, like, bookmark, leave a message, discuss and learn together, and grow together.