部署webrtc开源工程owt

Owt是intel领导下的一个开源项目,GitHub - open-webrtc-toolkit/owt-server: General server (streaming/conference/transcoding/anayltics) for OWT. (A.k.a. MediaServer)

它是支持MCU方式的一个webrtc 解决方案。Key features:

  1. Distributed, scalable, and reliable SFU + MCU server
  2. High performance VP8, VP9, H.264, and HEVC real-time transcoding on Intel® Core™ and Intel® Xeon® processors。

虽然实测表明系统不太稳定,在iOS平台上的web兼容性也较差,但作为一个参考工程来说,还是有许多值得借鉴和学习之处。

部署过程:

  1. 取得最新的稳定发布版本。

wget https://github.com/open-webrtc-toolkit/owt-server/archive/refs/tags/v5.0.1.tar.gz

  1. 解压后进入docker子目录

$ sudo docker build --target wrs-run -f Dockerfile.wrs -t wrs-run:v1.0.0 .
$ docker run -itd --name=wrs-run --net=host -v /home/admin:/mnt/admin -v /tmp/owt-logs:/home/owt/logs wrs-run:v1.0.0 bash

Docker build的结果会获得两个container,一个用于开发owt:build,一个用于发布owt:run

admin@ip-172-31-6-220:~$ sudo docker images

REPOSITORY      TAG           IMAGE ID       CREATED       SIZE

wrs-run         v1.0.0        42aac408b6d0   2 weeks ago   1.11GB

                  b3e6dc8cbb1e   2 weeks ago   15.4GB

运行相关的脚本都在bin目录下面

admin@ip-172-31-6-220:~/workspace/wrs-1.0.0-dist/bin$ ls

daemon.sh  detectOS.sh  init-all.sh  init-mongodb.sh  init-rabbitmq.sh  install_node.sh  restart-all.sh  start-all.sh  stop-all.sh

$ sudo docker exec -it wrs-run bash

$ ./bin/init-all.sh --deps --hardware

这个init脚本会检测并启动mongodb-server和rabbitmq-brocker。

当然也可以分开部署这两个独立的服务,但放在一起执行,要简单一些。

修改一些必要的config参数:

$ vi  webrtc_agent/agent.toml

# The webrtc port range
maxport = 60000 #default: 0
minport = 10000 #default: 0

network_interfaces = [{name = "ens5", replaced_ip_address = "13.214.217.118"}]  # default: []

vi portal/portal.toml

hostname = "api.yzbabyu.com" #default: ""

vi bin/start-all.sh   //SIP电话接入meeting不需要支持,因此从启动脚本中关闭。

#${bin}/daemon.sh start analytics-agent $1
#${bin}/daemon.sh start sip-agent $1
#${bin}/daemon.sh start sip-portal $1

#${bin}/daemon.sh start analytics-agent $1  //分析服务也不需要启动,挺复杂的。

import ssl-certificate and initcert.js like below:

owt@ip-172-31-6-220:~/management_api$ ./initcert.js
owt@ip-172-31-6-220:~/management_console$ ./initcert.js
owt@ip-172-31-6-220:~/portal$ ./initcert.js
owt@ip-172-31-6-220:~/webrtc_agent$ ./initcert.js

owt@ip-172-31-6-220:~/apps/current_app$ ./initcert.js

modify default config/db-setttings:

vi conference_agent/data_access/model/roomModel.js

var Resolution = {
  width: { type: Number, default: 1920 },
  height: { type: Number, default: 1080 }
};

$./bin/start-all.sh

登录管理后台:

https://api.yzbabyu.com:3300/console

登录会议室:

https://api.yzbabyu.com:3004/

Trouble shooting

1. Build http(s) req error: { Error: connect ECONNREFUSED 127.0.0.1:3000

    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3000 }
getRooms failed( 503 ): { Error: connect ECONNREFUSED 127.0.0.1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
  errno: 'ECONNREFUSED',

fix: $ pkill -9 node && $./bin/start-all.sh

原因就是启动有时不成功,要重新启动一下。

2. 2022-02-15 01:38:17.640  - ERROR: WorkingNode - Error: libgstreamer-1.0.so.0: cannot open shared object file: No such file or directory

fix: do not start analytics-agent

#${bin}/daemon.sh start analytics-agent $1

3. index.js:205 server connection failed: Error: Joining room failed

    at owt.js:9:69921

>> 分析

2022-02-17 01:14:53.311  - ERROR: RoomController - new mix terminal failed. room_id: 620d9efcf6f0637201545fe4 reason: Failed in scheduling video worker, reason: No worker matches the preference.
2022-02-17 01:14:53.312  - ERROR: RoomController - init fail. view: common reason: Failed in scheduling video worker, reason: No worker matches the preference.
2022-02-17 01:14:53.312  - ERROR: Conference - roomController init failed. Failed in scheduling video worker, reason: No worker matches the preference.
2022-02-17 01:14:53.313  - ERROR: Conference - Init room failed, reason: roomController init failed. reason: Failed in scheduling video worker, reason: No worker matches the preference.
2022-02-17 01:14:53.313  - WARN: Conference - Participant XG0rjSf9tvOWxSBTAAAH join room 620d9efcf6f0637201545fe4 failed, err: roomController init failed. reason: Failed in scheduling video worker, reason: No worker matches the preference.
2022-02-17 01:14:53.314  - INFO: WorkingNode - Process exit

感觉就是client端与server端没有协商一致,导致join room失败,如果作为audience join,应该不至于受到拒绝吧?!可以深入研究一下。

你可能感兴趣的:(流媒体,webrtc)