前面
记录下编译过程
源码
编译
编译准备
mkdir webrtc_h265
cd webrtc_h265
下载depot_tools(需要翻墙网络)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools
下载代码
git clone https://github.com/open-webrtc-toolkit/owt-client-native
配置环境变量
echo "export PATH=$PWD/depot_tools:$PATH" > $HOME/.bash_profile
source $HOME/.bash_profile
检查是否配置成功
echo $PATH
把owt-client-native 改成 src
mv owt-client-native src
在webrtc_h265下 创建 .gclient文件
touch .gclient
把 .gclinet 文件内容修改为
solutions = [
{
"managed": False,
"name": "src",
"url": "https://github.com/open-webrtc-toolkit/owt-client-native.git",
"custom_deps": {},
"deps_file": "DEPS",
"safesync_url": "",
},
]
target_os = ["ios"]
文件结构
同步代码
gclient sync
进入src下
cd src
开始编译
vpython scripts/build.py
编译完成
--- webrtc-h265/src ‹main* M?› » vpython scripts/build.py 127 ↵
Done. Made 1723 targets from 264 files in 171397ms
编译结果
H265验证
网上随便找个WebRTC-native的demo,把RTCDefaultVideoDecoderFactory和RTCDefaultVideoEncoderFactory改成RTCVideoDecoderFactoryH265和RTCVideoEncoderFactoryH265即可。
本人是在flutter-webrtc-demo 的demo中。
- 把编译好的WebRTC.frameworoks改成一个本地pod库
Pod::Spec.new do |spec|
spec.name = "LdsWebRTC"
spec.version = "0.0.1"
spec.summary = "xx"
spec.description = <<-DESC
WebRTC pre-compiled library for Darwin.
The binary files in this repository are compiled using Google WebRTC source code M version,
and a series of optimization patches from the webrtc-sdk community have been added.
DESC
spec.homepage = "xxx"
spec.license = { :type => 'BSD', :file => 'WebRTC.xcframework/LICENSE' }
spec.author = "webrtc-sdk"
spec.ios.deployment_target = '10.0'
spec.osx.deployment_target = '10.11'
spec.pod_target_xcconfig = {'ENABLE_BITCODE' => 'YES'}
spec.vendored_frameworks = "Classes/WebRTC.framework"
spec.source = { :git => 'https://xxx/xx', :tag => spec.version.to_s }
end
-
修改flutter_webrtc.podspec的"s.dependency 'WebRTC-SDK', '92.4515.07'"改成"s.dependency 'LdsWebRTC'"
-
在podfile 添加本地pod依赖
target 'Runner' **do**
pod 'LdsWebRTC', :path => './Webrtc/'
flutter_install_all_ios_pods File.dirname(File.realpath( **__FILE__** ))
**end**
文件结构如下
最后
支持H265的framework是可正常使用的。