webrtcDemo

[TOC]

TURN服务器测试网站验证
ICE 交互式链接建立 https://webrtchacks.com/trickle-ice/
ICE是计算机网络中使用的技术用来在点对点的网络中查找两台计算机(endpoint)之间尽可能的直接通讯的路径
测试环境搭建 https://webrtc.org/getting-started/testing
AppRTC collider offical doc https://github.com/webrtc/apprtc/blob/master/src/collider/README.md
AppRTC 搭建 自建 AppRTC
分析andriod 信令服务器工作过程 WebRTC for Android
挺详细的搭建指南 WebRTC开源项目-手把手教你搭建AppRTC
CloudRetro 游戏栗子 https://github.com/giongto35/cloud-game
webM libvpx: VP8/VP9 Codec SDK https://www.webmproject.org/code/
webrtc 的js栗子 https://webrtc.github.io/samples/
coturn服务器的配置 https://docs.bigbluebutton.org/2.2/setup-turn-server.html
coturn github https://github.com/coturn/coturn
coturn官方安装文档 https://github.com/coturn/coturn/blob/master/INSTALL
how to install coturn
How to create and configure your own STUN/TURN server with coturn in Ubuntu 18.04
原生开发 The currently supported platforms are Windows, Mac OS X, Linux, http://webrtc.github.io/webrtc-org/native-code/development/
APP Android and iOS. See the Android and iOS pages
ios App开发 http://webrtc.github.io/webrtc-org/native-code/ios/
android App开发 http://webrtc.github.io/webrtc-org/native-code/android/
Cannot see the v4l2loopback using google-chrome or …
https://srcco.de/posts/using-obs-studio-with-v4l2-for-google-hangouts-meet.html
https://webrtc.org/->source Repository https://webrtc.googlesource.com/src
拥塞优化 evaluate the Google Congestion Control for WebRTC
go call windows dll https://github.com/golang/go/wiki/WindowsDLLs

gn reference gn 参考

https://gn.googlesource.com/gn/+/master/docs/reference.md

target_os https://gn.googlesource.com/gn/+/master/docs/reference.md#var_target_os

1
2
3
4
5
6
7
- "android"
- "chromeos"
- "ios"
- "linux"
- "nacl"
- "mac"
- "win"

IDE-options https://gn.googlesource.com/gn/+/master/docs/reference.md#IDE-options

depot_tools

depot_tools 批处理脚本(fetch 为bash 文件,内部调用 fetch.py )

是对mac/windows/linux等平台构建开发环境和下封装代码控制的工具gi t/svn的wrapper工具 ,可以认为是代码和工具包的上层接口。

利用depot_tools 如何 fetch构建目标开发环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$ fetch --help
usage: fetch.py [options] <config> [--property=value [--property2=value2 ...]]

This script can be used to download the Chromium sources. See
http://www.chromium.org/developers/how-tos/get-the-code
for full usage instructions.

Valid options:
-h, --help, help Print this message.
--nohooks Don't run hooks after checkout.
--force (dangerous) Don't look for existing .gclient file.
-n, --dry-run Don't run commands, only print them.
--no-history Perform shallow clones, don't fetch the full git history.

Valid fetch configs:
android
android_internal
breakpad
chromium
config_util
crashpad
dart
depot_tools
devtools-frontend
goma_client
gyp
infra
infra_internal
inspector_protocol
ios
ios_internal
nacl
naclports
node-ci
pdfium
skia
skia_buildbot
syzygy
v8
webrtc #windows ??
webrtc_android # android
webrtc_ios # ios
1
2
3
4
5
6
7
Your current directory appears to already contain, or be part of,
a checkout.
"fetch" is used only to get new checkouts.
Use "gclient sync" to update existing checkouts.

Fetch also does not yet deal with partial checkouts, so if fetch
failed, delete the checkout and start over (crbug.com/230691).
1
2
3
4
5
6
7
8
9
10
11
12
# http://webrtc.github.io/webrtc-org/native-code/development/
fetch --nohooks webrtc
gclient sync


# ios #http://webrtc.github.io/webrtc-org/native-code/ios/
fetch --nohooks webrtc_ios
gclient sync

# http://webrtc.github.io/webrtc-org/native-code/android/
fetch --nohooks webrtc_android
gclient sync

Block Diagram http://webrtc.github.io/webrtc-org/native-code/native-apis/

apprtc 房间+web 服务器 + collider 信令服务器

coturn 打洞/中转服务器

1、AppRTC - 房间服务器。Github
2、Collider - 信令服务器。上面 Github 工程里自带,在 src/collider 下
3、coTurn - 打洞(内网穿透)服务器
4、还需要自己实现一个 coTurn 连接信息(主要是用户名、密码的配置)获取接口,通常叫做 TURN REST API。

https://amryousef.me/android-webrtc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

yum -y install java-1.8.0-openjdk-devel java-1.8.0-openjdk
yum -y install openssl-devel libevent libevent-devel
yum -y install nodejs npm python python-webtest golang php-fpm nginx
npm -g install grunt-cli


# https://openjdk.java.net/install/




$ apt install nodejs
node --version
v8.10.0

sudo apt install -y curl && curl -O https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz

tar -xvf node-v12.16.3-linux-x64.tar.xz

cd ~/cui/node-v12.16.3-linux-x64/bin

$sudo ln -s `pwd`/node /usr/local/bin/
$sudo ln -s `pwd`/npm /usr/local/bin

$sudo npm -g install grunt-cli
sudo ln -s `pwd`/grunt /usr/local/bin/

#重新exit bash, node 生效

搭建AppRTC Demo

apprtc

https://github.com/webrtc/apprtc

搭建环境指南

README.md

Running AppRTC locally requires Google App Engine SDK for Python, Node.js and Grunt.

Follow the instructions on Node.js website, Python PIP and on Grunt website to install them.

安装Python和Python-webtest (python2.7)

When Node.js and Grunt are available you can install the required dependencies running npm install and pip install -r requirements.txt from the project root folder.

Before you start the AppRTC dev server and everytime you update the source code you need to recompile the App Engine package by running grunt build.

Start the AppRTC dev server from the out/app_engine directory by running the Google App Engine SDK dev server,

1
<path to sdk>/dev_appserver.py ./out/app_engine

Then navigate to http://localhost:8080 in your browser (given it’s on the same machine).

  1. server OS: Ubuntu 18.04.3 LTS

  2. install openJDK

    1
    2
    3
    4
    5
    6
    7
    8
    9

    $sudo apt update
    $sudo apt-get install openjdk-8-jdk
    ##// sudo update-alternatives --config java
    ##// sudo update-alternatives --config javac
    $ java -version
    openjdk version "1.8.0_252"
    OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
    OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
  3. install python 2

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10


    # 没有则输入下命令
    sudo apt-get install python
    # python 安装之后安装 Python-webtest
    sudo apt-get install python-webtest


    python -V
    Python 2.7.17
  1. Google App Engine SDK for Python

install GAE for python (offline version) 安装Python和Python-webtest (python2.7)

Google Engine SDK

官网地址:https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python

https://cloud.google.com/appengine/docs/standard/python/download

if Python 2.7 isn’t installed, install it now using the installation instructions for your Linux distribution.

A6883E96-561F-4C79-87AF-065DEEE8FB23

47149482-8A67-478B-B346-9D8C8CC9AC37

3D4B284F-C3F7-4A73-8916-6799A073FA5F

下载 GAE (下载并安装原始的 Python 2 版 App Engine SDK)

https://cloud.google.com/appengine/docs/standard/python/download#python_linux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.91.zip

版本:
1.9.91 - 2020-05-11

大小:
53.8MB

SHA1 校验和:
36c802d46ccc7ea9b02bcaed40014f9ecbd1158c

如需在 Linux 系统中安装,请执行以下操作:

解压缩您下载的 google_appengine_1.9.91.zip 文件,例如:
unzip google_appengine_1.9.91.zip

将文件解压缩后,无需运行 App Engine 安装脚本。

将 google_appengine 目录添加到您的 PATH 环境变量:
export PATH=$PATH:DIRECTORY_PATH/google_appengine/

使用以下命令验证您的机器已安装 Python 2.7:
/usr/bin/env python -V

输出应如下所示:Python 2.7.[NUMBER]。如果未安装 Python 2.7,请立即使用您的 Linux 发行版的安装说明进行安装。
  1. install Go

    1
    2
    3
    4
    wget https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz

    export PATH=$PATH:/DIRECT_PATH/go/bin
    export GOPATH=

    path 防重机制 export 多次路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#set -x
echo "before:" $PATH

if [ $(echo $PATH|grep -c google_appengine) -eq 0 ] ; then
export PATH=$PATH:/home/andrew/cui/webrtcSetEnv/google_appengine
fi

if [ $(echo $PATH|grep -c "go/bin") -eq 0 ] ; then
export PATH=$PATH:/home/andrew/cui/webrtcSetEnv/go/bin
fi

echo "after:" $PATH

#set +x
  1. apprtc (js+python) (默认端口 8080)

    image-20200604184917430
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

# 依赖

# AppRTC 依赖 grunt 和 Google AppEngine SDK for Python 离线版本
$npm install grunt-cli
$sudo apt update
$sudo apt-get install python-pip python-setuptools -y
$pip install -U pip setuptools
$sudo pip install requests

git clone https://github.com/webrtc/apprtc.git

#将collider的源码软连接到go的工作目录下
https://github.com/webrtc/apprtc/blob/master/src/collider/README.md


AppRTC 依赖 grunt 和 Google AppEngine SDK for Python 离线版本。




sudo grunt build


cd apprtc
$grunt build
$. ./env.sh

cd apprtc
dev_appserver.py --host=0.0.0.0 --port=8080 ./out/app_engine --skip_sdk_update_check

--port PORT lowest port to which application modules should bind
(default: 8080)

$ ./runapprtc.sh
[in] /home/andrew/cui/webrtcSetEnv/apprtc
INFO 2020-06-04 09:30:39,636 devappserver2.py:289] Skipping SDK update check.
WARNING 2020-06-04 09:30:40,607 simple_search_stub.py:1198] Could not read search indexes from /tmp/appengine.None.andrew/search_indexes
INFO 2020-06-04 09:30:40,609 api_server.py:282] Starting API server at: http://localhost:33401
INFO 2020-06-04 09:30:40,625 dispatcher.py:267] Starting module "default" running at: http://0.0.0.0:8080
INFO 2020-06-04 09:30:40,625 admin_server.py:150] Starting admin server at: http://localhost:8000
INFO 2020-06-04 09:30:42,669 instance.py:294] Instance PID: 29277





1.
修改apprtc/src/app_engine/apprtc.py
搜索 "wss:""https:"
可以在方法 get_wss_parameters 里搜索到,
把 wss: -> ws:、把 https: -> http:,保存

146: wss_url = 'wss://' + wss_host_port_pair + '/ws'
147: wss_post_url = 'https://' + wss_host_port_pair


2. 修改apprtc/src/app_engine/constants.py
./src/app_engine/constants.py:41:ICE_SERVER_BASE_URL = 'https://networktraversal.googleapis.com'


① 搜索 TURN_BASE_URL
将等号后面的字符串替换为 apprtc 可以访问到的地址,如:'http://apprtc.domain.com:8083'

② 搜索 WSS_INSTANCES
./out/app_engine/constants.py:49:WSS_INSTANCES = [{
./out/app_engine/constants.py-50- WSS_INSTANCE_HOST_KEY: 'apprtc-ws.webrtc.org:443',
./out/app_engine/constants.py-51- WSS_INSTANCE_NAME_KEY: 'wsserver-std',
./out/app_engine/constants.py-52- WSS_INSTANCE_ZONE_KEY: 'us-central1-a'
./out/app_engine/constants.py-53-}, {
./out/app_engine/constants.py-54- WSS_INSTANCE_HOST_KEY: 'apprtc-ws-2.webrtc.org:443',
./out/app_engine/constants.py-55- WSS_INSTANCE_NAME_KEY: 'wsserver-std-2',
./out/app_engine/constants.py-56- WSS_INSTANCE_ZONE_KEY: 'us-central1-f'
./out/app_engine/constants.py-57-}]
./out/app_engine/constants.py-58-
# 即是: 只保留一个 WSS_INSTANCES
WSS_INSTANCES = [{
#只修改 WSS_INSTANCE_HOST_KEY 对应的值为Collider 服务器的可访问地址,比如:apprtc.domain.com:8089 不需要协议,没有 URI。
WSS_INSTANCE_HOST_KEY: 'apprtc-ws.webrtc.org:443',
WSS_INSTANCE_NAME_KEY: 'wsserver-std',
WSS_INSTANCE_ZONE_KEY: 'us-central1-a'
}]

CEOD_KEY要和上面TURN REST API中的key相同
保存退出

3.
在apprtc文件夹下编译npm install和grunt build -force
在google_appengine文件夹下执行/dev_appserver.py
如果要外网访问,加上host和端口,如:./dev_appserver.py --host 121.40.28.178 --port 80 --admin_host 121.40.28.178 /root/apprtc/out/app_engine/
4. 参照上面的配置,在浏览器中打开http://121.40.28.178即可访问



---------------build-error---------------------------------------------
$sudo grunt build
grunt-cli: The grunt command line interface (v1.3.2)

Fatal error: Unable to find local grunt.

If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:

https://gruntjs.com/getting-started


$ sudo grunt build
Running "shell:buildAppEnginePackage" (shell) task
Traceback (most recent call last):
File "./build/build_app_engine_package.py", line 12, in <module>
import requests
ImportError: No module named requests
Warning: Command failed: python ./build/build_app_engine_package.py src out/app_engine
Traceback (most recent call last):
File "./build/build_app_engine_package.py", line 12, in <module>
import requests
ImportError: No module named requests
Use --force to continue.

Aborted due to warnings.


sudo pip install requests

第四个 Server:ICE Server。

https://blog.piasy.com/2017/06/17/out-of-the-box-webrtc-dev-env/index.html

https://github.com/Piasy/WebRTC-Docker/blob/master/apprtc-server/constants.py

#将collider的源码软连接到go的工作目录下
https://github.com/webrtc/apprtc/blob/master/src/collider/README.md

  1. Open src/app_engine/constants.py and do the following:

    Collider

    这里的 8089 是服务端口 对外提供服务需要将 8089:tcp 映射出外网。

  • If using Google Cloud Engine VM’s for Collider
    • Change WSS_INSTANCE_HOST_KEY, WSS_INSTANCE_NAME_KEY and WSS_INSTANCE_ZONE_KEY to corresponding values for your VM instances which can be found in the Google Cloud Engine management console.
  • Else if using other VM hosting solution
    • Change WSS_INSTANCE_HOST_KEY to the hostname and port Collider is listening too, e.g. localhost:8089 or otherHost:443.
  1. a

  2. a

信令服务器(Collider Server)(代码包含在 apprtc代码内 apprtc/src/collider)

1
2
3
4
# 配置防火墙允许访问8089/tcp端口(用于客户端和collider建立websocket信令通信)

# 执行collider 信令服务器
sudo nohup $GOPATH/bin/collidermain -port=8089 -tls=false -room-server="http://0.0.0.0:8080" > sig.log 2>sigerr.log &

STUN\TURN服务器 coturn

https://github.com/coturn/coturn/blob/master/INSTALL
coturn->INSTALL->IV. OPENSSL
https://github.com/openssl/openssl
Configure TURN
OpenSSL vs FIPS enabled OpenSSL
OpenSSL 3.0 and FIPS Update

ubuntu 18.04 sudo apt install coturn

/etc/init.d/coturn (启动文件)

/etc/turnserver.conf (默认的配置文件,编译的话,默认是/usr/local/etc/turnserver.conf下)

/etc/default/coturn

1
2
3
4
5
6
cat /etc/default/coturn
#
# Uncomment it if you want to have the turnserver running as
# an automatic system service daemon
#
#TURNSERVER_ENABLED=1

/etc/logrotate.d/coturn (自定义文件)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
wget http://coturn.net/turnserver/v4.5.0.7/turnserver-4.5.0.7.tar.gz

sudo apt-get install libssl-dev
sudo apt-get install libevent-dev

# 返回webrtc目录
cd ~/webrtc
#git clone https://github.com/coturn/coturn.git
#cd coturn
#提供另一种安装方式turnserver是coturn的升级版本
wget http://coturn.net/turnserver/v4.5.0.7/turnserver-4.5.0.7.tar.gz
tar xfz turnserver-4.5.0.7.tar.gz
cd turnserver-4.5.0.7

# dependencies
# OpenSSL, SQLite, libevent2, PostgreSQL, MySQL (or MariaDB) and Hiredis
# libraries can be downloaded from their web sites:
- http://www.openssl.org (required);
- http://www.libevent.org (required);
- http://www.sqlite.org (optional);
- http://www.postgresql.org (optional);
- http://www.mysql.org (or http://mariadb.org) (optional);
- https://github.com/mongodb/mongo-c-driver (optional);
- http://redis.io (optional).



1) Download the OpenSSL version from openssl.org.
2) Let's assume that we want to install the "custom" OpenSSL into /opt.
Configure and build OpenSSL as:
$ ./config --prefix=/opt
$ make
$ make install
# coturn
./configure --prefix=/opt
make
sudo make install


sudo apt search libevent

src/client/ns_turn_msg.c:257:7: warning: implicit declaration of function ‘FIPS_mode’ [-Wimplicit-function-declaration]
if (FIPS_mode()) {
src/client/ns_turn_msg.c:257:7: warning: nested extern declaration of ‘FIPS_mode’ [-Wnested-externs]
/usr/bin/ld: warning: libssl.so.1.1, needed by /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libevent_openssl.so, may conflict with libssl.so.3
/usr/bin/ld: warning: libcrypto.so.1.1, needed by /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libevent_openssl.so, may conflict with libcrypto.so.3
/usr/bin/ld: /tmp/ccm8psVp.o: undefined reference to symbol 'FIPS_mode@@OPENSSL_1_1_0'
//usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:134: recipe for target 'bin/turnserver' failed
https://docs.nginx.com/nginx/fips-compliance-nginx-plus/
# ------------OPENSSL_1_1_0--FIPS mode not supported-------------------
# https://docs.nginx.com/nginx/fips-compliance-nginx-plus/

openssl$ ./config fips --prefix=/opt
Operating system: x86_64-whatever-linux2

Failure! build file wasn't produced.
Please read INSTALL.md and associated NOTES files. You may also have to
look over your available compiler tool chain or change your configuration.

FIPS mode not supported

# ----------------------------- # -----------------------------

https://gist.github.com/konklone/3e3a7072088a3352f3f6


sudo make install
install -d /usr/local
install -d /usr/local/bin
install -d /usr/local/var/db
install -d /usr/local/man/man1
install -d /usr/local/etc
install -d /usr/local/lib
install -d /usr/local/share/examples/turnserver
install -d /usr/local/share/doc/turnserver
install -d /usr/local/share/turnserver
install -d /usr/local/include/turn
install bin/turnserver /usr/local/bin
install bin/turnadmin /usr/local/bin
install bin/turnutils_uclient /usr/local/bin
install bin/turnutils_peer /usr/local/bin
install bin/turnutils_stunclient /usr/local/bin
install bin/turnutils_oauth /usr/local/bin
install bin/turnutils_natdiscovery /usr/local/bin
install man/man1/turnserver.1 /usr/local/man/man1/
install man/man1/turnadmin.1 /usr/local/man/man1/
install man/man1/turnutils.1 /usr/local/man/man1/
install man/man1/turnutils_uclient.1 /usr/local/man/man1/
install man/man1/turnutils_stunclient.1 /usr/local/man/man1/
install man/man1/turnutils_oauth.1 /usr/local/man/man1/
install man/man1/turnutils_natdiscovery.1 /usr/local/man/man1/
install man/man1/turnutils_peer.1 /usr/local/man/man1/
install man/man1/coturn.1 /usr/local/man/man1/
install lib/libturnclient.a /usr/local/lib
install LICENSE /usr/local/share/doc/turnserver
install README.turnserver /usr/local/share/doc/turnserver
install README.turnadmin /usr/local/share/doc/turnserver
install README.turnutils /usr/local/share/doc/turnserver
install INSTALL /usr/local/share/doc/turnserver
install postinstall.txt /usr/local/share/doc/turnserver
install turndb/schema.sql /usr/local/share/doc/turnserver
install turndb/schema.sql /usr/local/share/turnserver
install turndb/schema.mongo.sh /usr/local/share/doc/turnserver
install turndb/schema.mongo.sh /usr/local/share/turnserver
install turndb/testredisdbsetup.sh /usr/local/share/turnserver
install turndb/testmongosetup.sh /usr/local/share/turnserver
install turndb/testsqldbsetup.sql /usr/local/share/turnserver
install turndb/schema.userdb.redis /usr/local/share/doc/turnserver
install turndb/schema.userdb.redis /usr/local/share/turnserver
install turndb/schema.stats.redis /usr/local/share/doc/turnserver
install turndb/schema.stats.redis /usr/local/share/turnserver
if [ -f sqlite/turndb ] ; then install sqlite/turndb /usr/local/var/db/turndb; fi
install examples/etc/turnserver.conf /usr/local/etc/turnserver.conf.default
cp -rpf examples/etc /usr/local/share/examples/turnserver
cp -rpf examples/scripts /usr/local/share/examples/turnserver
rm -rf /usr/local/share/examples/turnserver/scripts/rfc5769.sh
cp -rpf include/turn/client /usr/local/include/turn
install include/turn/ns_turn_defs.h /usr/local/include/turn
cat /usr/local/share/doc/turnserver/postinstall.txt
==================================================================

1) If your system supports automatic start-up system daemon services,
then to enable the turnserver as a system service that is automatically
started, you have to:

a) Create and edit /etc/turnserver.conf or
/usr/local/etc/turnserver.conf .
Use /usr/local/etc/turnserver.conf.default as an example.

b) For user accounts settings: set up SQLite or PostgreSQL or
MySQL or MongoDB or Redis database for user accounts.
Use /usr/local/share/turnserver/schema.sql as SQL database schema,
or use /usr/local/share/turnserver/schema.userdb.redis as Redis
database schema description and/or
/usr/local/share/turnserver/schema.stats.redis
as Redis status & statistics database schema description.

If you are using SQLite, the default database location is in
/var/db/turndb or in /usr/local/var/db/turndb or in /var/lib/turn/turndb.

c) add whatever is necessary to enable start-up daemon for the
/usr/local/bin/turnserver.

2) If you do not want the turnserver to be a system service,
then you can start/stop it "manually", using the "turnserver"
executable with appropriate options (see the documentation).

3) To create database schema, use schema in file
/usr/local/share/turnserver/schema.sql.

4) For additional information, run:

$ man turnserver
$ man turnadmin
$ man turnutils

==================================================================


/usr/local/etc$ sudo cp turnserver.conf.default turnserver.conf
1
2
3
4
5
6


turnserver in /usr/local/ directory (or to whatever directory
was set in the PREFIX variable). You will have to copy
/usr/local/etc/turnserver.conf.default to /usr/local/etc/turnserver.conf file
and adjust your runtime configuration

https://www.red5pro.com/docs/server/turnstun.html

https://amryousef.me/android-webrtc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

sudo apt-get update
$ sudo apt-get install coturn







# 可为 TURN 服务提供更安全的访问
stale-nonce

# SSL 需要用到的, 生成命令:
# sudo openssl req -x509 -newkey rsa:2048 -keyout /etc/turn_server_pkey.pem -out /etc/turn_server_cert.pem -days 99999 -nodes
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem





diff turnserver.conf turnserver.conf.default
12c12
< listening-device=eno1
---
> #listening-device=eth0
60c60
< listening-ip=192.168.1.103
---
> #listening-ip=172.17.19.101
92c92
< relay-device=eno1
---
> #relay-device=eth1
157,158c157,158
< min-port=49152
< max-port=65535
---
> #min-port=49152
> #max-port=65535
162c162
< verbose
---
> #verbose
173c173 # WebRTC 的消息里会用到
< fingerprint
---
> #fingerprint
178c178 # WebRTC 的认证
< lt-cred-mech
---
> #lt-cred-mech
224c224 # REST API 认证需要

< use-auth-secret
---
> #use-auth-secret
232c232 # REST API 加密所需的 KEY
< static-auth-secret=north2202
---
> #static-auth-secret=north
346c346 # 用户登录域
< realm=myRealm
---
> #realm=mycompany.org
513c513
< log-file=/var/log/turn.log
---
> #log-file=/var/tmp/turn.log
523c523 # To enable single filename logs you need to enable the simple-log flag
< simple-log
---
> #simple-log
604c604 # 屏蔽 multicast IP地址的 relay
< no-multicast-peers
---
> #no-multicast-peers
637c637
< mobility
---
> #mobility
662c662
< no-cli
---
# 禁用本地 telnet cli 管理接口
no-cli
> #no-cli
723,724c723,724
< no-tlsv1
< no-tlsv1_1
---
> #no-tlsv1
> #no-tlsv1_1


sudo find /etc/ -iname "coturn" -type f
/etc/init.d/coturn
/etc/default/coturn
/etc/logrotate.d/coturn


$cat /etc/default/coturn
#
# Uncomment it if you want to have the turnserver running as
# an automatic system service daemon
#
#TURNSERVER_ENABLED=1


$ cat /etc/init.d/coturn
#!/bin/sh
### BEGIN INIT INFO
# Provides: coturn
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: coturn TURN Server
# Description: STUN and TURN Relay Server for VoIP and WebRTC
### END INIT INFO

# Author: Oleg Moskalenko <mom040267@gmail.com>

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/bin:/sbin:/usr/sbin:/bin
DESC=coturn # COTURN
NAME=coturn # TURN Server
PROCNAME=turnserver # Binary name
DAEMON=/usr/bin/turnserver
DAEMON_ARGS="-c /etc/turnserver.conf -o -v" # Arguments to run the daemon with
PIDFILE_DIR=/var/run
PIDFILE=/var/run/$PROCNAME.pid
SCRIPTNAME=/etc/init.d/$NAME
USER=turnserver
GROUP=turnserver

# Exit if the package is not installed
[ -x $DAEMON ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

if [ ! -d "$PIDFILE_DIR" ];then
mkdir -p "$PIDFILE_DIR"
chown $USER:$GROUP "$PIDFILE_DIR"
fi

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name ${PROCNAME}
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $PROCNAME
return 0
}

case "$1" in
start)

if test "$TURNSERVER_ENABLED" = 1; then
log_daemon_msg "Starting $DESC " "$PROCNAME"
do_start
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
else
log_daemon_msg "${NAME} disabled in /etc/default/${NAME}" "${PROCNAME}"
log_end_msg 0
log_daemon_msg "See /etc/default/${NAME} for instructions on enabling" "${PROCNAME}"
log_end_msg 0
exit 0
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$PROCNAME"
do_stop
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$PROCNAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$PROCNAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

exit 0
andrew@N8:~/cui/webrtcSetEnv/coturn$

To rotate the logs for coturn, install the following configuration file to /etc/logrotate.d/coturn

1
2
3
4
5
6
7
8
9
10
11
12
13

/var/log/coturn.log
{
rotate 30
daily
missingok
notifempty
delaycompress
compress
postrotate
systemctl kill -sHUP coturn.service
endscript
}

Required DNS EntryAnchor link for: required dns entry

You need to setup a fully qualified domain name that resolves to the external IP address of your turn server. You’ll used this domain name to generate a TLS certificate using Let’s Encrypt (next section).

On the coturn server, you need to have the following ports (in addition port 22) available for BigBlueButton clients to connect (port 3478 and 443) and for coturn to connect to your BigBlueButton server (49152 - 65535).

Ports Protocol Description
3478 TCP/UDP coturn listening port
443 TCP/UDP TLS listening port
49152-65535 UDP relay ports range

安装Nginx

注意安装的时候要带ssl

生成证书

1
2
3
4
5

# CA私钥
openssl genrsa -out key.pem 2048
# 自签名证书
openssl req -new -x509 -key key.pem -out cert.pem -days 1095
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


upstream roomserver {
server 192.168.1.123:8080;
}
server {
listen 443 ssl;
ssl_certificate /cert/cert.pem;
ssl_certificate_key /cert/key.pem;
charset utf-8;
# ip地址或者域名
server_name 192.168.1.123;
location / {
# 转向代理的地址
proxy_pass http://roomserver$request_uri;
proxy_set_header Host $host;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

upstream websocket {
server 192.168.1.123:8089;
}

server {
listen 8088 ssl;
ssl_certificate /cert/cert.pem;
ssl_certificate_key /cert/key.pem;

server_name 192.168.1.123;
location /ws {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_connect_timeout 4s;
proxy_read_timeout 6000s; #配置点2,如果没效,可以考虑这个时间配置长一点
proxy_send_timeout 6000s; #配置点3
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}

# https://www.nginx.com/blog/websocket-nginx/
location /wsapp/ {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
}

How to Proxy WSS WebSockets with NGINX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

sudo apt-get update
#安装依赖:gcc、g++依赖库
sudo apt-get install build-essential libtool
#安装 pcre依赖库(http://www.pcre.org/)
sudo apt-get install libpcre3 libpcre3-dev
#安装 zlib依赖库(http://www.zlib.net)
sudo apt-get install zlib1g-dev
#安装ssl依赖库
sudo apt-get install openssl


#下载nginx 1.15.8版本
wget http://nginx.org/download/nginx-1.15.8.tar.gz
tar xvzf nginx-1.15.8.tar.gz
cd nginx-1.15.8/


# 配置,一定要支持https
./configure --with-http_ssl_module

# 编译
make

#安装
sudo make install

启动服务

1
2


安装e2esoft vcam 虚拟摄像头

由于我本地是台式电脑,没有摄像头,另一方面,为了调试的方便,安装这个虚拟摄像头。

我是在这里下载的http://www.loveliao.com/downfiles/VCam_v4.5.exe

ubuntu https://github.com/umlaeute/v4l2loopback
git clone https://github.com/umlaeute/v4l2loopback.git
1st make && sudo make instal
2nd sudo depmod -a
3rd sudo modprobe v4l2loopback
4th sudo apt install v4l-utils
sudo modprobe v4l2loopback exclusive_caps=1
1
2
3
4

$sudo v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video0

OPTIONS https://github.com/umlaeute/v4l2loopback

if you need several independent loopback devices, you can pass the “devices” option, when loading the module; e.g.

1
# modprobe v4l2loopback devices=4

will give you 4 loopback devices (e.g. /dev/video1/dev/video5)

you can also specify the device IDs manually; e.g.

1
# modprobe v4l2loopback video_nr=3,4,7

will create 3 devices (/dev/video3, /dev/video4 & /dev/video7)

1
# modprobe v4l2loopback video_nr=3,4,7 card_label="device number 3","the number four","the last one"

will create 3 devices with the card names passed as the second parameter:

  • /dev/video3 -> device number 3
  • /dev/video4 -> the number four
  • /dev/video7 -> the last one

if you encounter problems detecting your device with Chrome/WebRTC you can try ‘exclusive_caps’ mode:

1
# modprobe v4l2loopback exclusive_caps=1

will enable ‘exclusive_caps’ mode that only reports CAPTURE/OUTPUT capabilities exclusively. the newly created device will announce OUTPUT capabilities only (so ordinary webcam applications (including Chrome) won’t see it). as soon as you have attached a producer to the device, it will start announcing CAPTURE capabilities only (so applications that refuse to open devices that have other capabilities apart from capturing can open it too.)

install chrome on ubuntu 18.04

https://linuxize.com/post/how-to-install-google-chrome-web-browser-on-ubuntu-18-04/

1
2
3

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb

❌错误信息

1
2
3
4
5
6
7
8
9
10
11
12
13
Request: 
Http Reqest Room :8080 webpage
GET /room HTTP/1.1
Host: a.b.com # 反向代理

Response:
Request host is not whitelist enabled for this server. Please use the --host command-line flag to whitelist a specific host (recommended) or use --enable_host_checking to disable host checking. See the command-line flags help text for more information.


$ dev_appserver.py --help |grep check
--enable_host_checking [ENABLE_HOST_CHECKING]
determines whether to enforce HTTP Host checking for
host checking protects against DNS rebinding attacks

https://cloud.google.com/appengine/docs/standard/python/release-notes

December 05, 2017

Python runtime notes

  • Updated Python SDK to version 1.9.64.

  • For all incoming HTTP requests, dev_appserver.py now requires that all HTTP requests must have an HTTP Host header and its value is either localhost, an IPv4 or IPv6 loopback address, or if specified, the value passed in via --host. For HTTP/1.0 only, requests with no Host header are still allowed. To disable host checking, set the --enable_host_checking flag to false. However, it is strongly recommended to leave host checking enabled, as it guards against DNS rebinding attacks.

  • Introduced additional security-header related behavior to the

1
dev_appserver.py

admin console:

  • Inbound requests containing an Origin header are rejected.
  • Added the following headers to all responses:
    • X-Frame-Options=SAMEORIGIN
    • X-XSS-Protection=1; mode=block
    • Content-Security-Policy=default-src 'self'; frame-ancestors 'none'

浏览器通话跨域问题 :pushState

https://github.com/ISBX/apprtc-node-server/issues/7

https://github.com/webrtc/apprtc/issues/309

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Messages:
Failed to start signaling: Failed to execute 'pushState' on 'History': A history state object with URL 'http://a.abc.com/r/961479685' cannot be created in a document with origin 'https://a.abc.com:12345' and URL 'https://a.abc.com:12345/'.

Version:
branch: master
gitHash: 09411754b4fde46f86fa16057c114ff2ff25cb06
time: Tue Jan 21 10:12:29 2020 +0000




$ grep -nrI "displaySharingInfo_" apprtc/

apprtc/src/web_app/js/appcontroller.js:180: this.call_.oncallerstarted = this.displaySharingInfo_.bind(this);
apprtc/src/web_app/js/appcontroller.js:445:AppController.prototype.displaySharingInfo_ = function(roomId, roomLink)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

States:
Signaling: have-local-offer
Gathering: complete
Connection: new
Local: host:1
Remote:

Stats:
Call time: 00:37
Setup time: 0 ms

Messages:
Error getting user media: Failed to execute 'getUserMedia' on 'MediaDevices': At least one of audio and video must be requested
getUserMedia error: Failed to get access to local media. Error name was TypeError. Continuing without sending a stream.

Version:
branch: master
gitHash: 09411754b4fde46f86fa16057c114ff2ff

http://www.lidetao.com/base-webrtc-apprtc.html

How to use TURN_SERVER_OVERRIDE config in AppRTC-Android client? #456

ios App 开发环境搭建

原生开发 http://webrtc.github.io/webrtc-org/native-code/development/
ios App开发 http://webrtc.github.io/webrtc-org/native-code/ios/
预安装的软件 http://webrtc.github.io/webrtc-org/native-code/development/prerequisite-sw/
$ export PATH=/path/to/depot_tools:$PATH

SETTING UP

GET DEPOT TOOLS

LINUX / MAC

Clone the depot_tools repository:

1
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

Add depot_tools to the front of your PATH (you will probably want to put this in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools to /path/to/depot_tools:

1
$ export PATH=/path/to/depot_tools:$PATH

WINDOWS

Download the depot_tools bundle and extract it somewhere.

Warning DO NOT use drag-n-drop or copy-n-paste extract from Explorer, this will not extract the hidden “.git” folder which is necessary for depot_tools to autoupdate itself. You can use “Extract all…” from the context menu though.

Add depot_tools to the front of your PATH (must be ahead of any installs of Python). Assuming you unzipped the bundle to C:\workspace\depot_tools:

  • With Administrator access:

    Control Panel → System and Security → System → Advanced system settingsModify the PATH system variable to include C:\workspace\depot_tools.

  • Without Administrator access:

    Control Panel → User Accounts → User Accounts → Change my environment variablesAdd a PATH user variable: C:\workspace\depot_tools;%PATH%.

From a cmd.exe shell, run the command gclient (without arguments). On first run, gclient will install all the Windows-specific bits needed to work with the code, including msysgit and python.

Note If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), it may appear to run properly, but msysgit, python, and other tools may not get installed correctly.If you see strange errors with the file system on the first run of gclient, you may want to disable Windows Indexing.After running gclient open a command prompt and type where python and confirm that the depot_tools python.bat comes ahead of any copies of python.exe. Failing to ensure this can lead to overbuilding when using gn - see crbug.com/611087.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# 创建新目录
# 1st
$ fetch --nohooks webrtc_ios
Running: gclient root
Warning: Running gclient on Python 3.
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will be created.
Running: gclient config --spec 'solutions = [
{
"name": "src",
"url": "https://webrtc.googlesource.com/src.git",
"deps_file": "DEPS",
"managed": False,
"custom_deps": {},
},
]
target_os = ["ios", "mac"]
'
Warning: Running gclient on Python 3.
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
Running: gclient sync --nohooks --with_branch_heads
Warning: Running gclient on Python 3.
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.

________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://webrtc.googlesource.com/src.git /Users/whoami/github/myWebRTC/_gclient_src__a4lopbz' in '/Users/whoami/github/myWebRTC'
Cloning into '/Users/whoami/github/myWebRTC/_gclient_src__a4lopbz'...
remote: Sending approximately 275.98 MiB ...
remote: Total 355662 (delta 268284), reused 355662 (delta 268284)
Receiving objects: 100% (355662/355662), 275.88 MiB | 2.99 MiB/s, done.
Resolving deltas: 100% (268284/268284), done.

$ du -sh .
11G .

$ll -a
total 24
drwxr-xr-x 6 whoami staff 192B Jun 8 18:41 .
drwxr-xr-x 174 whoami staff 5.4K Jun 8 17:23 ..
drwxr-xr-x 5 whoami staff 160B Jun 8 18:41 .cipd
-rw-r--r-- 1 whoami staff 195B Jun 8 17:25 .gclient
-rw-r--r-- 1 whoami staff 5.8K Jun 8 18:41 .gclient_entries
drwxr-xr-x 63 whoami staff 2.0K Jun 8 18:07 src

# 2nd step
$ gclient sync

$ cd src
$git checkout master
$git new-branch your-branch-name

# Generating project files
$ gn gen out/Aios64 --args='target_os="ios" target_cpu="arm64”'
Done. Made 1173 targets from 237 files in 1881ms

$ cd out/Aios64
~/github/myWebRTC/src/out/Aios64 on  whoami ⌚ 12:02:43
$ ll
total 1040
-rw-r--r-- 1 whoami staff 53B Jun 9 12:01 args.gn
-rw-r--r-- 1 whoami staff 249K Jun 9 12:01 build.ninja
-rw-r--r-- 1 whoami staff 9.0K Jun 9 12:01 build.ninja.d
-rw-r--r-- 1 whoami staff 2.3K Jun 9 12:01 low_bandwidth_audio_perf_test.runtime_deps
drwx------ 34 whoami staff 1.1K Jun 9 12:01 obj
-rw-r--r-- 1 whoami staff 246K Jun 9 12:01 toolchain.ninja

#### Compiling with ninja
# To see a list of available targets, run gn ls out/<output folder
# To compile, just run ninja on the appropriate target.
# $gn ls out out/Aios64
$gn ls out/Aios64 |grep -i apprtc
//examples:AppRTCMobile
//examples:AppRTCMobile_executable
//examples:AppRTCMobile_executable_bundle_data
//examples:AppRTCMobile_info_plist
//examples:AppRTCMobile_info_plist_bundle_data
//examples:AppRTCMobile_info_plist_merge
//examples:AppRTCMobile_lib
//examples:AppRTCMobile_pkg_info
//examples:AppRTCMobile_pkg_info_bundle_data
//examples:apprtc_common
//examples:apprtc_signaling

$ ninja --help
usage: ninja [options] [targets...]

if targets are unspecified, builds the 'default' target (see manual).

options:
--version print ninja version ("1.8.2")

-C DIR change to DIR before doing anything else
-f FILE specify input build file [default=build.ninja]

-j N run N jobs in parallel [default=10, derived from CPUs available]
-k N keep going until N jobs fail [default=1]
-l N do not start new jobs if the load average is greater than N
-n dry run (don't run commands but act like they succeeded)
-v show all command lines while building

-d MODE enable debugging (use -d list to list modes)
-t TOOL run a subtool (use -t list to list subtools)
terminates toplevel options; further flags are passed to the tool
-w FLAG adjust warnings (use -w list to list warnings)

$ninja -C out/Aios64 AppRTCMobile


# Using Xcode

Generating an Xcode project

To have GN generate Xcode project files, pass the argument --ide=xcode when running gn gen. This will result in a file named all.xcworkspace placed in your specified output directory.

Example:


$ gn gen out/ios --args='target_os="ios" target_cpu="arm64"' --ide=xcode
Generating Xcode projects took 159ms
Done. Made 1535 targets from 225 files in 3102ms

$gn gen out/ios --args='target_os="ios" target_cpu="arm64"' --ide=xcode
#原因: 多证书,其中一个过期/吊销证书导致的
#解决: 删除过期/吊销的证书即可
ERROR at //build/config/ios/ios_sdk.gni:163:33: Script returned non-zero exit code.
ios_code_signing_identity = exec_script("find_signing_identity.py",
^----------
Current dir: /Users/whoami/github/myWebRTC/src/out/ios/
Command: python /Users/whoami/github/myWebRTC/src/build/config/ios/find_signing_identity.py --matching-pattern Apple Development
Returned 1 and printed out:

Automatic code signing identity selection was enabled but could not
find exactly one codesigning identity matching "Apple Development".

Check that the keychain is accessible and that there is exactly one
valid codesigning identity matching the pattern. Here is the parsed
output of `xcrun security find-identity -v -p codesigning`:

1) 76FD9*************************: "Apple Development: x (4EEZB*****)"
2) F09A2*************************: "Developer ID Application: x (69SZU*****)"
3) 4C392*************************: "Apple Development: x(2CV36*****)"
4) 70C1E*************************: "Apple Development: x (4EEZB*****)"
5) 780DB*************************: "iPhone Developer: x (2CV36*****)"
5 valid identities found

See //build/config/sysroot.gni:74:5: whence it was imported.
import("//build/config/ios/ios_sdk.gni")
^--------------------------------------
See //build/config/linux/pkg_config.gni:5:1: whence it was imported.
import("//build/config/sysroot.gni")
^----------------------------------
See //BUILD.gn:15:1: whence it was imported.
import("//build/config/linux/pkg_config.gni")
^-------------------------------------------





$open -a Xcode.app out/ios/all.xcworkspace
Compile and run with Xcode

# Compiling with Xcode is not supported! What we do instead is compile using a script that runs ninja from Xcode. This is done with a custom run script action in the build phases of the generated project. This script will simply call ninja as you would when building from the command line.

#This gives us access to the usual deployment/debugging workflow iOS developers are used to in Xcode, without sacrificing the build speed of Ninja



#### Deploying to Device
#NOTICE: To deploy to an iOS device you must have a valid signing identity set up. You can verify this by running:
$ xcrun security find-identity -v -p codesigning

If you don’t have a valid signing identity, you can still build for ARM, but you won’t be able to deploy your code to an iOS device. To do this, add the flag ios_enable_code_signing=false to the gn gen args when you generate the build files.

gn gen out/Aios64 –args=’target_os=”ios” target_cpu=”arm64”’

ninja -C out/Aios64 AppRTCMobile

$ ios-deploy -b AppRTCMobile.app

Download available profile, regenerate app, iOS-deploy ok.

修改 appid 为你自己的 appid

Com.google.AppRTCMobile为 我自己的appid com.ouid.AppRTCMobile

~/webrtc/webrtc_ios/src/webrtc/examples/objc/AppRTCMobile/ios/Info.plist

~/webrtc/webrtc_ios/src/webrtc/sdk/objc/Framework/Info.plist

1A6A172C-0EB8-4D3B-AE0F-0FAB544BC407
gn gen out/Aios64 –args=’target_os=”ios” target_cpu=”arm64”‘
55B1FBC4-387D-4BBE-BA52-2E8D9A56C362
ninja -C out/Aios64 AppRTCMobile
D5133157-6926-40E2-88E6-A6E1F91E078D
Xcode 快捷键 Shift + command +2 安装
F98E182C-9F71-47DD-BCAF-E2E5C889D0E6

$ ll

total 1256

drwxr-xr-x 24 whoami staff 816B 10 25 19:52 AppRTCMobile.app

drwxr-xr-x 8 whoami staff 272B 10 25 19:52 WebRTC.framework

-rw-r–r– 1 whoami staff 39B 10 25 18:52 args.gn

-rw-r–r– 1 whoami staff 190K 10 25 18:52 build.ninja

-rw-r–r– 1 whoami staff 8.9K 10 25 18:52 build.ninja.d

drwx—— 5 whoami staff 170B 10 25 19:50 clang_x64

drwxr-xr-x 3 whoami staff 102B 10 25 19:49 gen

drwx—— 6 whoami staff 204B 10 25 18:52 obj

drwxr-xr-x 3 whoami staff 102B 10 25 19:50 pyproto

-rw-r–r– 1 whoami staff 416K 10 25 18:52 toolchain.ninja

~/webrtc/webrtc_ios/src/out/Aios64 on  7aeabd081! ⌚ 20:15:31

$ tree AppRTCMobile.app

6 directories, 65 files

$Cd ~/webrtc/webrtc_ios/src/out/Aios64

安装app到手机上

~/webrtc/webrtc_ios/src/out/Aios64 on  7aeabd081! ⌚ 20:29:20

$ ios-deploy -b AppRTCMobile.app

[….] Waiting for iOS device to be connected

[….] Using (N56AP, iPhone 6 Plus, iphoneos, arm64) a.k.a. ‘iPhone’.

—— Install phase ——

[ 95%] GeneratingApplicationMap

[100%] Installed package AppRTCMobile.app

即使没有ios developer program 也可以在真机上跑

0D6E1E6F-1677-4CC4-BE76-0870E7EC28E1
71947ADD-222C-446E-8C4D-AE0A1656469C
生成一个project, 随便填写appid (orgnation + productioName), xcode 会自动(Generation->check autogenerate option)帮你生成appid, 在webrtc/src下修改 Info.plist 的id,为自己的前面生成的appid,(注意保持唯一性)
0F6B0BF2-B074-45B6-9BFA-5A4129B77679

编译webrtc框架 WebRTC.framework Using WebRTC in your app

Refer: http://webrtc.github.io/webrtc-org/native-code/ios/

To build WebRTC for use in a native iOS app, it’s easiest to build WebRTC.framework. This can be done with ninja as follows, replacing ios with the actual location of your generated build files.

1
ninja -C out/ios framework_objc

This should result in a .framework bundle being generated in out/ios. This bundle can now be directly included in another app.

If you need a FAT .framework, that is, a binary that contains code for multiple architectures, and will work both on device and in the simulator, a script is available here

To build the framework with bitcode support, pass the --bitcode flag to the script like so

1
python build_ios_libs.py --bitcode

The resulting framework can be found in out_ios_libs/.

Please note that you can not ship the FAT framework binary with your app if you intend to distribute it through the app store. To solve this either remove “x86-64” from the list of architectures in the build script or split the binary and recreate it without x86-64. For instructions on how to do this see here

ios App http://webrtc.github.io/webrtc-org/native-code/ios/
https://webrtc.googlesource.com/src
fetch –nohooks webrtc_ios vs git clone https://webrtc.googlesource.com/src
image-20200608221754925

gdi capture

1
2
3
4
5
6
7
8
9
// Set up a timer to give me a frame rate / basic update time. seperate from WM_PAINT
TIMESYS_t dwTimeWaitMS = 1000 / 60; //60fps
m_uTimerId = ::SetTimer( m_hWnd, IDT_TIMER, dwTimeWaitMS, NULL );

window proc handle timer GDI.OnTimer(放重入)
window proc WM_PAINT GDI.OnTimer (防重入)

// 重中之中
HRESULT CTaksiGAPI_GDI::GetFrame( CVideoFrame& frame, bool bHalfSize )
1
2
3
4
5
6
7
8
9

HRESULT CTaksiGAPI_GDI::HookFunctions()
{
// we should capture WM_PAINT + periodic

// we should capture WM_PAINT + periodic
// ONLY CALLED FROM AttachGAPI()
// RETURN:
// S_FALSE = wont hook but not an error.

webrtc 全平台编译指南

webrtc所有平台下载编译步骤详细说明- 简书

webrtc mac

[WebRTC 开发(五)编译与运行Mac 工程 Depth.Love Blog](https://depthlove.github.io/2019/10/18/webrtc-development-5-run-mac-project/)
WebRTC iOS&OSX 库的编译
下载WebRTC最新源码并编译动态库
https://raw.githubusercontent.com/barry-ran/learn-webrtc/master/build_for_mac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export GYP_DEFINES="OS=mac"
fetch --nohooks webrtc_ios
gclient sync




gn gen out/Debug-mac --args='target_os="mac" target_cpu="x64" is_component_build=false'

gn gen out/mac --args='target_os="mac" target_cpu="x64"' --ide=xcode

gn gen out/Debug --ide=xcode --args='is_debug=true' --mac_deployment_target=10.10 --rtc_include_tests=true
gn gen out/Release --ide=xcode --args='is_debug=false' --mac_deployment_target=10.10 --rtc_include_tests=true



for i in `find /Users/zf/webrtc1128/webrtc-checkout/src/out_ios32 -name "lib*.a"`
do
echo $i
cp $i ./out_ios32/
done
libtool -static -v -o out_ios32/libwebrtc32.a out_ios32/*.a
strip -S -X out_ios32/libwebrtc32.a
for i in `find /Users/zf/webrtc1128/webrtc-checkout/src/out_ios64 -name "lib*.a"`
do
echo $i
cp $i ./out_ios64/
done
libtool -static -v -o out_ios64/libwebrtc64.a out_ios64/*.a
strip -S -X out_ios64/libwebrtc64.a

webrtc ios

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export GYP_DEFINES="OS=ios"
fetch --nohooks webrtc_ios
gclient sync





gn gen out/ios --args='target_os="ios" target_cpu="arm64"' --ide=xcode


# target_os

- "android"
- "chromeos"
- "ios"
- "linux"
- "nacl"
- "mac"
- "win"

build_ios_libs.sh

1
2
3
4
5
6
7
8
9
10
11
12

~/github/webrtc_ios/src/tools_webrtc/ios on  choe! ⌚ 17:26:46
$ ll
total 88
-rw-r--r-- 1 choe staff 18B Jun 8 17:30 OWNERS
-rwxr-xr-x 1 choe staff 8.2K Jun 8 17:30 build_ios_libs.py
-rwxr-xr-x 1 choe staff 563B Jun 8 17:30 build_ios_libs.sh
-rw-r--r-- 1 choe staff 1.1K Jun 8 17:30 generate_modulemap.py
-rw-r--r-- 1 choe staff 1.5K Jun 8 17:30 generate_umbrella_header.py
-rwxr-xr-x 1 choe staff 4.1K Jun 8 17:30 merge_ios_libs.py
-rw-r--r-- 1 choe staff 495B Jun 8 17:30 no_op.cc
-rw-r--r-- 1 choe staff 764B Jun 8 17:30 objc_app.plis

webrtc on linux

1
2
3
4
5
6
7



export GYP_DEFINES="OS=linux"
fetch --nohooks webrtc_android
gclient sync
./build/install-build-deps.sh

webrtc on android

1
2
3
4
5

export GYP_DEFINES="OS=android"
fetch --nohooks webrtc_android
gclient sync
./build/install-build-deps.sh

windows 编译 webrtc

Windows编译运行webrtc全过程- 云中双月- 博客园
Windows平台WebRTC编译-VS2017 - 剑痴乎
webrtc windows编译+vs2017 - osc_c6q6fan2的个人空间 …
Building and Installing WebRTC on Windows
ssh + tar (windows10) 导致解压缩写文件失败 -> remote desktop + WSL + ubuntu + tar
win10 + cmd(admin mode) 编译成功
https://github.com/barry-ran/learn-webrtc
https://www.jianshu.com/p/351b29e36243
https://juejin.im/post/5e2126926fb9a02fdd3899b6

command line proxy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

set HTTP_PROXY=http://user:password@proxy.domain.com:port
set HTTPS_PROXY=http://user:password@proxy.domain.com:port

set HTTP_PROXY=http://127.0.0.1:8118
set HTTPS_PROXY=http://127.0.0.1:8118

# 验证 OK 1080(socks5)
set HTTP_PROXY=127.0.0.1:1080
set HTTPS_PROXY=127.0.0.1:1080


# 有问题 ???
set http_proxy=socks5://127.0.0.1:1080
set https_proxy=socks5://127.0.0.1:1080


git config –global http.proxy 'socks5://127.0.0.1:1080'
git config –global https.proxy 'socks5://127.0.0.1:1080'
set https_proxy=socks5://127.0.0.1:1080


https://www.cnblogs.com/hongdada/p/10787924.html
https://www.privoxy.org/user-manual/installation.html#INSTALLATION-PACK-WIN
  1. 下载depot-tools 设置到环境变量里面 (PATH)

    http://webrtc.github.io/webrtc-org/native-code/development/prerequisite-sw/

    https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up

    curl -O https://storage.googleapis.com/chrome-infra/depot_tools.zip

    WINDOWS

    Download the depot_tools bundle and extract it somewhere.

    Warning DO NOT use drag-n-drop or copy-n-paste extract from Explorer, this will not extract the hidden “.git” folder which is necessary for depot_tools to autoupdate itself. You can use “Extract all…” from the context menu though.

    Add depot_tools to the front of your PATH (must be ahead of any installs of Python). Assuming you unzipped the bundle to C:\workspace\depot_tools:

    • With Administrator access:

      Control Panel → System and Security → System → Advanced system settingsModify the PATH system variable to include C:\workspace\depot_tools.

    • Without Administrator access:

      Control Panel → User Accounts → User Accounts → Change my environment variablesAdd a PATH user variable: C:\workspace\depot_tools;%PATH%.

    From a cmd.exe shell, run the command gclient (without arguments). On first run, gclient will install all the Windows-specific bits needed to work with the code, including msysgit and python.

    Note If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), it may appear to run properly, but msysgit, python, and other tools may not get installed correctly.If you see strange errors with the file system on the first run of gclient, you may want to disable Windows Indexing.After running gclient open a command prompt and type where python and confirm that the depot_tools python.bat comes ahead of any copies of python.exe. Failing to ensure this can lead to overbuilding when using gn - see crbug.com/611087.
    1
    2
    3
    4
    5
    6
    7
    8
    depot_tools>where python
    C:\Users\juyun\AppData\Local\Microsoft\WindowsApps\python.exe
    # 第一次运行 gclient
    c:\webrt>gclient
    # 检测
    c:\webrtc>where python
    C:\webrtc\depot_tools\python.bat
    C:\Users\juyun\AppData\Local\Microsoft\WindowsApps\python.exe
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    # 第一次运行 gclient
    c:\cui\depot_tools>gclient
    Downloading CIPD client for windows-amd64 from https://chrome-infra-packages.appspot.com/client?platform=windows-amd64&version=git_revision:0323cbe1ef467af36aa6784f2315c5ee36e89e34...
    Failed to download the file, check your network connection
    所在位置 C:\cui\depot_tools\.cipd_impl.ps1:116 字符: 5
    + throw "Failed to download the file, check your network connection ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Failed to downl...work connection:String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to download the file, check your network connection

    Failed to bootstrap or update CIPD client
    Error updating depot_tools, no revision tool found.

    c:\cui\depot_tools>gclient
    Downloading CIPD client for windows-amd64 from https://chrome-infra-packages.appspot.com/client?platform=windows-amd64&version=git_revision:0323cbe1ef467af36aa6784f2315c5ee36e89e34...
    Warning: Running gclient on Python 3.
    If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
    WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will be created.
    Usage: gclient.py <command> [options]

    Meta checkout dependency manager for Git.

    Commands are:
    config creates a .gclient file in the current directory
    diff displays local diff for every dependencies
    fetch fetches upstream commits for all modules
    。。。。。。。。。。。
  1. 安装完VS 2019, VC 2019 + win10 SDK 10.0.19041.0

  2. cmd设置环境变量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
   cmd设置临时环境变量:
#ninja Build https://chromium.googlesource.com/chromium/src/+/56.0.2886.1/docs/ninja_build.md

#export GYP_DEFINES="OS=win"

set DEPOT_TOOLS_UPDATE=0 #不更新depot_tools

set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_GENERATORS=msvs-ninja,ninja

######skip begin######
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc #获取代码VPN
######skip end######

gclient sync --force
cd src
gn gen out/Default --ide=vs2019
ninja -C out/Default



####################可能不需要的################################

set GYP_MSVS_VERSION=2019
set GYP_MSVS_OVERRIDE_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
set GYP_GENERATORS=msvs-ninja,ninja
set WINDOWSSDKDIR="C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10"
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
#也可以直接设置环境变量,告诉depot_tools使用我们本机的VS进行编译。
######skip begin######
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc #获取代码VPN
######skip end######

gclient sync

cd src
gn gen out/Default --ide=vs2019
gn.py: Could not find gn executable at: c:\webrtc\webrtcNative\src\buildtools\win\gn.exe

Exception: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"\VC\vcvarsall.bat is missing
实际情况是:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat
# -------------------------------------------
Toolchain is out of date. Run "gclient runhooks" to update the toolchain, or set DEPOT_TOOLS_WIN_TOOLCHAIN=0 to use the locally installed toolchain.
#####





ninja -C out/Default


编译支持h264:

gn gen out/Debug_h264_ffmpeg --args="is_component_build=false rtc_use_h264=true proprietary_codecs=true is_component_ffmpeg=true ffmpeg_branding=\"Chrome\"" --ide=vs2019
ninja -C out/Debug_h264_ffmpeg

gn gen out/Debug_h264 --args="is_component_build=false rtc_use_h264=true proprietary_codecs=true ffmpeg_branding=\"Chrome\"" --ide=vs2019
ninja -C out/Debug_h264



生成debug版ninja:gn gen out/Default
生成release版ninja:gn gen out/Default --args='is_debug=false'
清空:gn clean out/Default


#####################编译############################################
c:\cui\webrtcNative\src>set DEPOT_TOOLS_WIN_TOOLCHAIN=0

c:\cui\webrtcNative\src>set GYP_GENERATORS=msvs-ninja,ninja

c:\cui\webrtcNative\src>gn gen out/Default --ide=vs2019
Generating Visual Studio projects took 9233ms
Done. Made 1106 targets from 234 files in 20037ms
c:\cui\webrtcNative\src>ninja -C out/Default
ninja: Entering directory `out/Default'
[5044/5044] STAMP obj/default.stamp
is_debug 是否是Debug版,默认true,false:表示编译Release版。
target_os 平台类型,可以取值win、mac ,android、ios、linux等
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的分支。
rtc_build_ssl 是否编译BoringSSL,这里取false,因为后面我们要替换成OpenSSL。
rtc_ssl_root OpenSSL的头文件路径,会被写到生成的ninja文件中。

gn help args可以查看args的帮助文件

gn args out/Debug_h264可以得到指定编译输出目录下的args配置文件

  1. bash

    1
    2
    3
    4
    5

    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

    #或者:
    curl -O https://storage.googleapis.com/chrome-infra/depot_tools.zip

    eerconnection_client要有摄像头

gclient sync error:提示 “You have unstaged changes”

1
2
3
4
5
6
7
8
9
10
11
12
13
14

fetch --nohooks webrtc
gclient sync

Error: 6>
6> ____ src\third_party at af73a24f3376b1d85dd1ea541e12de76312f24db
6> You have unstaged changes.
6> Please commit, stash, or reset.

cd src\third_party
git config core.filemode false
git restore .
cd ../..
gclient sync
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# gclient sync 最后面会执行hook

c:\webrtc\webrtc>gclient sync
Warning: Running gclient on Python 3.
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
Syncing projects: 100% (41/41), done.
Hook 'vpython.bat src/build/landmines.py --landmine-scripts src/tools_webrtc/get_landmines.py --src-dir src' took 31.68 secs
Running hooks: 50% (11/22) clang
________ running 'vpython.bat src/tools/clang/scripts/update.py' in 'C:\webrtc\webrtc'
Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Win/clang-n358615-fb1aa286-2.tgz .......... Done.
Running hooks: 59% (13/22) clang_format_win
________ running 'download_from_google_storage --no_resume --platform=win32 --no_auth --bucket chromium-clang-format -s src/buildtools/win/clang-format.exe.sha1' in 'C:\webrtc\webrtc'
0> Downloading src/buildtools/win/clang-format.exe@d4afd4eba27022f5f6d518133aebde57281677c9...
Downloading 1 files took 202.988000 second(s)
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Hook 'download_from_google_storage --no_resume --platform=win32 --no_auth --bucket chromium-clang-format -s src/buildtools/win/clang-format.exe.sha1' took 203.19 secs
Running hooks: 72% (16/22) rc_win
________ running 'vpython.bat src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang/rc -s src/build/toolchain/win/rc/win/rc.exe.sha1' in 'C:\webrtc\webrtc'
0> Downloading src/build/toolchain/win/rc/win/rc.exe@ba51d69039ffb88310b72b6568efa9f0de148f8f...
Downloading 1 files took 11.590000 second(s)
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Hook 'vpython.bat src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang/rc -s src/build/toolchain/win/rc/win/rc.exe.sha1' took 12.28 secs
Running hooks: 86% (19/22) test_fonts
________ running 'download_from_google_storage --no_resume --extract --no_auth --bucket chromium-fonts -s src/third_party/test_fonts/test_fonts.tar.gz.sha1' in 'C:\webrtc\webrtc'
0> Downloading src/third_party/test_fonts/test_fonts.tar.gz@cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb...
0> Extracting 33 entries from src/third_party/test_fonts/test_fonts.tar.gz to src/third_party/test_fonts/test_fonts
Downloading 1 files took 561.083000 second(s)
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Hook 'download_from_google_storage --no_resume --extract --no_auth --bucket chromium-fonts -s src/third_party/test_fonts/test_fonts.tar.gz.sha1' took 561.30 secs
Running hooks: 100% (22/22)

gclient sync 可以多次执行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
c:\webrtc\webrtc>gclient sync
Warning: Running gclient on Python 3.
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
Syncing projects: 100% (41/41), done.
Running hooks: 59% (13/22) clang_format_win
________ running 'download_from_google_storage --no_resume --platform=win32 --no_auth --bucket chromium-clang-format -s src/buildtools/win/clang-format.exe.sha1' in 'C:\webrtc\webrtc'
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Running hooks: 72% (16/22) rc_win
________ running 'vpython.bat src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang/rc -s src/build/toolchain/win/rc/win/rc.exe.sha1' in 'C:\webrtc\webrtc'
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Running hooks: 86% (19/22) test_fonts
________ running 'download_from_google_storage --no_resume --extract --no_auth --bucket chromium-fonts -s src/third_party/test_fonts/test_fonts.tar.gz.sha1' in 'C:\webrtc\webrtc'
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Running hooks: 100% (22/22)
________ running 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' in 'C:\webrtc\webrtc'
NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.
Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.
To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.
Running hooks: 100% (22/22), done.

user32.lib not foud

控制面板-》程序和功能 =〉vs 2019 右键菜单—》更改—〉check win10SDK 10.0.19041.0->修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
c:\webrtc\webrtc\src>gn gen out/Default --ide=vs2019
Traceback (most recent call last):
File "c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py", line 291, in <module>
Traceback (most recent call last):
File "c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py", line 291, in <module>
main()
File "c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py", line 244, in main
main()
vc_lib_um_path = FindFileInEnvList(env, 'LIB', ';', 'user32.lib')
File "c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py", line 244, in main
File "c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py", line 198, in FindFileInEnvList
vc_lib_um_path = FindFileInEnvList(env, 'LIB', ';', 'user32.lib')
file_name, env_name, '\n'.join(parts))
File "c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py", line 198, in FindFileInEnvList
AssertionError: ufile_name, env_name, '\n'.join(parts))
ser32.lib is not found in LIB:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\ATLMFC\lib\x86
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x86
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x86
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86

Check if it is installed.AssertionError
: user32.lib is not found in LIB:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\ATLMFC\lib\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64

Check if it is installed.
ERROR at //build/config/win/BUILD.gn:298:27: Script returned non-zero exit code.
vcvars_toolchain_data = exec_script("../../toolchain/win/setup_toolchain.py",
^----------
Current dir: c:/webrtc/webrtc/src/out/Default/
Command: C:/webrtc/depot_tools/bootstrap-3_8_0_chromium_8_bin/python/bin/python.exe c:/webrtc/webrtc/src/build/toolchain/win/setup_toolchain.py "C:\Program Files (x86)/Microsoft Visual Studio/2019/Community" "C:\Program Files (x86)\Windows Kits\10" "C:\WINDOWS\System32;C:\WINDOWS\SysWOW64;Arm64Unused" win x64 none
Returned 1.
See //build/config/BUILDCONFIG.gn:472:9: which caused the file to be included.

IDE options from https://gn.googlesource.com/gn/+/master/docs/reference.md

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
GN optionally generates files for IDE. Files won't be overwritten if their
contents don't change. Possibilities for <ide options>

--ide=<ide_name>
Generate files for an IDE. Currently supported values:
"eclipse" - Eclipse CDT settings file.
"vs" - Visual Studio project/solution files.
(default Visual Studio version: 2019)
"vs2013" - Visual Studio 2013 project/solution files.
"vs2015" - Visual Studio 2015 project/solution files.
"vs2017" - Visual Studio 2017 project/solution files.
"vs2019" - Visual Studio 2019 project/solution files.
"xcode" - Xcode workspace/solution files.
"qtcreator" - QtCreator project files.
"json" - JSON file containing target information

--filters=<path_prefixes>
Semicolon-separated list of label patterns used to limit the set of
generated projects (see "gn help label_pattern"). Only matching targets
and their dependencies will be included in the solution. Only used for
Visual Studio, Xcode and JSON.

windows webrtc+vs2019 成功编译

image-20200701113744176
image-20200701112330402
Exception: dbghelp.dll not found
c:\webrtc\webrtc\src>set DEPOT_TOOLS_WIN_TOOLCHAIN=0

c:\webrtc\webrtc\src>gn gen out/Default –ide=vs2019
Generating Visual Studio projects took 8700ms
Done. Made 1106 targets from 234 files in 18781ms
c:\cui\webrtcNative\src>echo %DEPOT_TOOLS_WIN_TOOLCHAIN%

c:\cui\webrtcNative\src>gn gen out/Default –ide=vs2019
Traceback (most recent call last):
File “c:/cui/webrtcNative/src/build/vs_toolchain.py”, line 578, in
sys.exit(main())
File “c:/cui/webrtcNative/src/build/vs_toolchain.py”, line 574, in main
return commandssys.argv[1]
File “c:/cui/webrtcNative/src/build/vs_toolchain.py”, line 389, in CopyDlls
_CopyDebugger(target_dir, target_cpu)
File “c:/cui/webrtcNative/src/build/vs_toolchain.py”, line 425, in _CopyDebugger
(debug_file, full_path))
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.
ERROR at //build/toolchain/win/BUILD.gn:49:3: Script returned non-zero exit code.
exec_script(“../../vs_toolchain.py”,
image-20200702185223589
image-20200702185108105