【WebRTC源码下载】
1)前置条件,能上外网,自行翻越
2)在Windows上安装Git,后面的命令都是在Git Bash上操作
3)下载depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
在环境变量中添加下面两项:
DEPOT_TOOLS_WIN_TOOLCHAIN = 0
depot_tools安装路径
4)下载WebRTC源码
创建文件夹
$ mkdir webrtc_src
$ cd webrtc_src
获取源码
$ fetch --nohooks webrtc
$ gclient sync
将分支定位到m84
$ cd src
$ git checkout -b m84 refs/remotes/branch-heads/4147
$ gclient sync
================================================================
***问题1*** fetch --nohooks webrtc时提示找不到Python3.exe
解决方法:可以先执行gclient,该命令会下载Python,完成后再执行fetch --nohooks webrtc
================================================================
***问题2*** gclient sync或者fetch --nohooks webrtc命令卡住,应该是网络不通
解决方法:
找到代理信息如socks5的端口号和http的端口号,执行命令
export http_proxy=socks5://127.0.0.1:10808
export https_proxy=socks5://127.0.0.1:10808
export all_proxy=socks5://127.0.0.1:10808
or上面网络依然不通
export http_proxy=http://127.0.0.1:10808
export https_proxy=http://127.0.0.1:10808
export all_proxy=http://127.0.0.1:10808
可以通过命令【curl www.google.com】测试网络是否正常
================================================================
【Windows上编译WebRTC】
命令行
x64MT
gn gen out/x64Release --args="is_debug=false is_clang=false is_component_build=false rtc_include_tests=false rtc_use_h264=true rtc_enable_protobuf=false use_rtti=true treat_warnings_as_errors=false target_cpu=\"x64\""
ninja -C out/x64Release
x64MTd
gn gen out/x64Debug --args="is_debug=true enable_iterator_debugging=true is_clang=false is_component_build=false rtc_include_tests=false rtc_use_h264=true rtc_enable_protobuf=false use_rtti=true treat_warnings_as_errors=false target_cpu=\"x64\""
ninja -C out/x64Debug
x86MT
gn gen out/x86Release --args="is_debug=false is_clang=false is_component_build=false rtc_include_tests=false rtc_use_h264=true rtc_enable_protobuf=false use_rtti=true treat_warnings_as_errors=false target_cpu=\"x86\""
ninja -C out/x86Release
x86MTd
gn gen out/x86Debug --args="is_debug=true enable_iterator_debugging=true is_clang=false is_component_build=false rtc_include_tests=false rtc_use_h264=true rtc_enable_protobuf=false use_rtti=true treat_warnings_as_errors=false target_cpu=\"x86\""
ninja -C out/x86Debug
================================================================
***问题1*** 在用gn gen XXX生成脚本时,提示Python permission denied
解决方法:
安装Python2.7.X,设置Python安装路径到环境变量path
================================================================
***问题2*** Exception: No supported Visual Studio can be found. Supported versions are: 16.0 (2019), 15.0 (2017).
解决方法:
安装vs2019
***问题2-1*** 安装vs2019依然报***问题2***
解决方法:
设置环境变量
set vs2019_install=D:\Program Files (x86)\Microsoft Visual Studio\2019\Community
set GYP_MSVS_OVERRIDE_PATH=D:\Program Files (x86)\Microsoft Visual Studio\2019\Community
set GYP_GENERATORS=msvs-ninja,ninja
================================================================
***问题3*** Exception: dbghelp.dll not found in "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll"
解决方法:
You must installWindows 10 SDK version 10.0.19041.0 including the "Debugging Tools for Windows" feature.
================================================================
***问题4*** See: bugs.webrtc.org/9213#c13.
解决方法:
将 modules\video_coding\codecs\h264\目录下的 h264_decoder_impl.h、h264_encoder_impl.h、h264_color_space.h 几个文件中的#error "See: bugs.webrtc.org/9213#c13." 注释掉。
================================================================
***问题5*** C2059 error "string"
解决方法:
注释掉\third_party\ffmpeg\libavcodec\pcm.c的最后一行,原因是PCM_VIDC这个标志未定义
================================================================
***问题6*** ffmpeg_internal.lib(pcm.obj) : error LNK2001: 无法解析的外部符号 avpriv_emms_asm(不影响最终webrtc库的生成)
解决方法:
替换FFmpeg文件
用clang就没那个问题,emms是MMX指令的,在clang的时候,它能支持ffmpeg的大多数内置汇编,msvc 不支持