向WebRTC提交代码过程实录

WebRTC写了一个帖子,一步步写明了向 webrtc 提交代码的步骤,最近解决了一个webrtc的安卓相机设置采集帧率可能匹配错误的 Bug,正好实操了一遍,记录分享一下。

— 本文来自公众号”PixPark”,作者 Liam Keh 的分享

个人贡献者协议

首先接受一下谷歌的个人贡献者许可协议,选择个人贡献者,成功之后是这个样子;

向WebRTC提交代码过程实录
个人贡献者协议

签出代码

这一步必须是完整的WebRTC 代码,包含依赖和三方库,后期提交代码的时候,上传工具会有一些提交前的检查,否则会报错或卡住。

代码签出参考:https://webrtc.googlesource.com/src/+/refs/heads/main/docs/native-code/development/

添加作者

在 webrtc源文件src/AUTHORS 文件中按照格式添加个人名字和邮箱, 注意个人在 individuals section 部分添加

配置 Git

转到https://webrtc.googlesource.com/new-password 登录谷歌账户,该帐号应与 git config user.email 返回的帐号相同,可以通过配置 ~/.gitconfig 里的邮箱来修改。页面生成一段配置脚本,在你电脑终端中执行一下

向WebRTC提交代码过程实录

检查配置,执行

git cl creds-check

git cl是谷歌 depot_tools 里的对git命令的自定义,depot_tools 下载WebRTC代码之前就要配置好, 没有错误会出现

git is already configured to use your .gitcookies from /Users/admin/.gitcookies
Your .netrc and .gitcookies have credentials for these hosts:
                          Host                    User  Which file
============================== ======================= ===========
webrtc-review.googlesource.com git-zhaoyouge.gmail.com .gitcookies
       webrtc.googlesource.com git-zhaoyouge.gmail.com .gitcookies

No problems detected in your .gitcookies file.

修改代码

就是普通的Git操作,通过命令或者其他GUI工具都可以 创建分支:

git checkout -b branch-name

修改代码后 commit:

git commit -am "修改内容的大概描述"

上传代码

上传之前最后把 git 和终端的代理都配置好,确保网络通畅:git配置代理:

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

终端配置代理:

export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

上传代码, src 目录执行

git cl upload -v

-v参数可以看到详细的输出日志。这里我遇到一个坑, 一直卡住不动,开始怀疑代理不通,弄了一晚上,后发现为了省流量,我只clone了 https://webrtc.googlesource.com/src 这一个仓库,上传代码会做简单的测试和代码分析,相关的依赖都没有:

错误 1:

Found change with 1 commit...
Running Python 3 presubmit upload checks ...
Ignoring /Users/admin/repos/github/webrtc/src/sdk/android/api/org/webrtc/CameraEnumerationAndroid.java; not a valid file name (cc, cu, cpp, cuh, h)

错误 2:

    from generate_licenses import LicenseBuilder
  File "/root/work/src/tools_webrtc/android/../libs/generate_licenses.py", line 116, in <module>
    import find_depot_tools
ModuleNotFoundError: No module named 'find_depot_tools'

然后没有错误之后,会弹出一个vim编辑器, 写一下代码修改的详细描述,之后就弹出一堆信息,上传成功:

...
...
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 938 bytes | 938.00 KiB/s, done.
Total 9 (delta 6), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (6/6)
remote: Waiting for private key checker: 2/2 objects left
remote: Processing changes: refs: 1, new: 1, done
remote: commit 674552b: warning: subject >50 characters; use shorter first paragraph
remote: commit 674552b: warning: too many message lines longer than 72 characters; manually wrap lines
remote:
remote: SUCCESS
remote:
remote:   https://webrtc-review.googlesource.com/c/src/+/342100 Fix Android camera error of obtaining FramerateRange closest to the set ... [NEW]
remote:
To https://webrtc.googlesource.com/src.git
 * [new reference]         674552b8d3fbcb0ced4644eb6ce753a6deb69b44 -> refs/for/refs/heads/main%m=Initial_upload

remote: https://webrtc-review.googlesource.com/c/src/+/342100 就是你上传代码 code review 的地址

Code Review

最后打开刚才的 code review 地址,登录账户,可以看到提交情况。

点击 Reviewers 旁边的铅笔,指定 code review的人,通过 suggest owners 选了两位reviewer,之后就是等待审核, Reviewer如果同意了补丁,则他们把提交放进提交队列

向WebRTC提交代码过程实录

版权声明:本文内容转自互联网,本文观点仅代表作者本人。本站仅提供信息存储空间服务,所有权归原作者所有。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至1393616908@qq.com 举报,一经查实,本站将立刻删除。

(0)

相关推荐

发表回复

登录后才能评论