下載:
1、由于webrtc 原始碼在 墻外,所以需要科學上網(自行解決),當然現在webrtc 有國內的鏡像地址:https://webrtc.org.cn/mirror 內附編譯下載教程自行查閱(下載后只包含M79 和最新的master 分支),由于個人專案需要M72 版本,所以需要科學上網,
2、需要在windows 上安裝git(version 2.23.0.windows.1),然后配置環境變數,后續需要在 “命令提示符” 中使用
3、下載depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
下載depot-tools之后解壓,把解壓目錄設定到環境變數里面 (PATH)
環境變數中添加下面兩項
DEPOT_TOOLS_WIN_TOOL_WIN_TOOLCHAIN = 0
4、下載WebRTC原始碼
創建檔案夾
$mkdir webrtc_wins
$cd webrtc_src
獲取原始碼
$fetch --nohooks webrtc
$gclient sync
將分支定位到m72
$cd src
$git checkout -b m72 refs/remotes/branch-heads/72
$gclient sync

編譯
1、編譯前需要配置一下環境
Visual Studio Community 2017 version 15.9.15
需要安裝的單個組件如下圖:

打開cmd設定臨時環境變數
$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
然后執行:
$cd src
$gn gen out/Default --ide=vs2017
$ninja -C out/Default
編譯支持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
遇到的問題:
問題:gclient sync 或者 fetch --nohooks webrtcmingl卡住 或443 timeout,應該是代理網路沒有設定好
如果沒有對版本的特殊要求建議采用webrtc 國內鏡像
解決:執行 set http_proxy=http://127.0.0.1:1080
set https_proxy=https://127.0.0.1:1080
然后通過 curl 測驗相關地址的網路
問題: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.
解決:隨便找個地方生成一個文本檔案,比如 D:\boto.cfg
在該檔案中輸入下面的內容(假設代理服務器是 http://http.proxy.com:1080):
[Boto]
proxy= http://http.proxy.com
proxy_port = 1080
然后設定環境變數
set NO_AUTH_BOTO_CONFIG=D:\boto.cfg
再執行 gclient sync
問題:“UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 7: ordi” 這個問題是因為同時安裝了python2和python3導致的
解決:執行 python -m pip install --upgrade pip
問題:Python中使用Win32api報錯的問題,No module named win32file
解決:pip install pypiwin32或pip3 install pypiwin32 或 python -m pip install pypiwin32
問題:webrtc編譯debug庫呼叫鏈接出現 error LNK2038: 檢測到“_ITERATOR_DEBUG_LEVEL”的不匹配項: 值“0”不匹配值“2”(main.obj 中) 錯誤
解決:在編譯時添加 enable_iterator_debugging = true
相關引數決議:
is_debug 是否是Debug版,默認true,false:表示編譯Release版,
target_os 平臺型別,可以取值win、android、ios、linux等,這里取win,表示Windows平臺,
target_cpu cpu型別,Windows下可以取x86、x64
is_component_build 是否使用動態運行期庫,這里取false,使用靜態運行期庫,Release版本將對應MT,Debug版將對應MTd,
proprietary_codecs 是否使用著作權編碼,也就是H264,這里取true,
rtc_use_h264 是否使用H264,這里取true,注意Windows平臺編碼使用OpenH264,解碼使用ffmpeg,
ffmpeg_branding ffmpeg的分支名,這里采用Chrome的分支,
is_clang 是否采用clang編譯器編譯,默認設定為true
所有編譯引數描述請直接查閱原始碼中src 目錄下 的webrtc.gni 檔案
歡迎關注、點贊、收藏、留言,一起討論學習,共同成長,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/197891.html
標籤:python
