Compare commits

...

153 Commits
v1.1.1 ... v4

Author SHA1 Message Date
langhuihui
4dc893e9fb fix: use engine's aac format 2024-09-27 10:05:32 +08:00
langhuihui
c943c2a0ec feat: add LATM support 2024-09-26 20:34:00 +08:00
langhuihui
eafbf28a02 feat: support LATM 2024-09-26 14:08:06 +08:00
langhuihui
97d72548c5 feat: use new engine 4.15.1 2024-07-09 19:59:32 +08:00
langhuihui
5e722bf849 feat: add desc to config 2023-12-13 15:27:10 +08:00
langhuihui
6c1207ae43 feat: add av1 and opus 2023-11-17 17:31:51 +08:00
langhuihui
c794c0514f rollback 2023-11-13 17:28:29 +08:00
langhuihui
e65f970097 fix: replace client wait 2023-11-12 12:07:14 +08:00
langhuihui
855038c132 Update dependencies and add audio format support 2023-11-03 14:12:05 +08:00
langhuihui
2a62472b1d feat: push use tcp default 2023-10-27 09:52:19 +08:00
langhuihui
3e4dcdf649 feat: add sendoptions config to avoid send options 2023-10-25 10:22:29 +08:00
langhuihui
9ac21a130e fix: auto close client 2023-10-25 08:57:33 +08:00
langhuihui
c13d8c659d feat: update gortsplib to v4 2023-10-23 14:20:15 +08:00
langhuihui
c4700713a8 feat: remove pull protocol config 2023-10-11 17:01:09 +08:00
langhuihui
62409f14b5 chore: update engine version 2023-09-20 19:24:26 +08:00
langhuihui
df9c5a69cc fix: memory leak 2023-09-15 14:23:59 +08:00
dexter
4a5ba9b834 Merge pull request #44 from umaYnit/v4
fix: 修复错误的流地址导致的Disconnect时panic
2023-08-31 08:42:12 +08:00
Ynit
5df8f237de fix: 修复错误的流地址导致的Disconnect时panic 2023-08-31 00:12:07 +08:00
langhuihui
9936b2ca20 fix: upgrade gortsplib 2023-08-25 15:00:57 +08:00
langhuihui
943ba46f70 chore: fit engine udpate 2023-08-14 10:04:37 +08:00
langhuihui
035c3647eb docs: update readme 2023-08-06 18:05:06 +08:00
langhuihui
17874da782 docs: udpate readme 2023-08-06 15:26:50 +08:00
langhuihui
24b63ca07c feat: add stop reason, pull protocol default is tcp now 2023-08-06 15:15:26 +08:00
dexter
eb91dd1cee Merge pull request #42 from Monibuca/rtsp-pcma
Update publisher.go
2023-07-24 13:45:37 +08:00
banshan
e5d0d7d5d6 Update publisher.go
ffmpeg rtsp pcma 推流
2023-07-24 13:43:44 +08:00
langhuihui
311b8732a8 fit engine update 2023-06-16 22:42:43 +08:00
langhuihui
351ff9fa0c refactor: remove some stupid code 2023-05-25 14:15:09 +08:00
langhuihui
9defe4eec3 fit engine update 2023-05-23 20:58:59 +08:00
langhuihui
8e84bb637a 适配引擎修改 2023-04-24 14:13:46 +08:00
langhuihui
dc62df1861 更新readme 2023-04-23 13:00:11 +08:00
langhuihui
1ad45bfbc1 gortsplib升级到v3.2.1
增加默认缓存大小,解决高码率推拉流问题
增加英文文档
2023-04-23 11:26:02 +08:00
langhuihui
a4773b4044 使用内置的协议自动选择机制 2023-04-15 08:48:44 +08:00
dexter
225bb482d5 适配引擎修改 2023-03-28 19:48:59 +08:00
dexter
ea5ea6f48a SizeLength、IndexLength、IndexDeltaLength 2023-03-03 22:06:38 +08:00
dexter
beda2dd9e0 适配引擎修改 2023-02-26 10:38:53 +08:00
dexter
344ab6f463 移除clockrate 2023-02-20 00:19:39 +08:00
dexter
d5e73d11db Merge pull request #32 from Monibuca/dependabot/go_modules/golang.org/x/net-0.7.0
Bump golang.org/x/net from 0.2.0 to 0.7.0
2023-02-19 10:22:56 +08:00
dependabot[bot]
12350b8af0 Bump golang.org/x/net from 0.2.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.2.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.2.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-18 03:22:09 +00:00
dexter
3b671606b6 添加时钟频率配置 2023-02-08 14:19:36 +08:00
dexter
70321ccd1f 更新依赖库aler9 到2.1.0 2023-02-03 21:36:33 +08:00
dexter
5ddbd7a852 优化代码 2023-02-02 12:08:16 +08:00
dexter
f32f44db40 适配引擎升级 2023-02-01 11:00:36 +08:00
dexter
b44efd9749 推拉在异常时对连接关闭 2023-01-18 21:20:06 +08:00
dexter
7f4bfe4c78 使用rtsp拉流时将参数传入订阅者 2023-01-02 21:12:45 +08:00
dexter
187335d311 适配engine v4.9.5 2022-12-31 22:18:50 +08:00
dexter
1f3f4bfb0e 适配引擎4.9.3 2022-12-19 09:06:17 +08:00
dexter
3cbf22576b 🐛 FIX: 关闭流后断开rtsp拉流或者推流连接 2022-11-23 09:22:23 +08:00
dexter
1206a4636f 👌 IMPROVE: 升级gortsplib版本 2022-11-17 23:48:13 +08:00
dexter
6063f42181 🐛 FIX: enable not enabled 2022-10-10 21:51:08 +08:00
dexter
2e6679b3ea 👌 IMPROVE: 添加初始化监听失败日志 2022-10-03 17:57:49 +08:00
dexter
022857c3d7 👌 IMPROVE: 增加一些错误信息输出 2022-09-06 18:56:19 +08:00
dexter
0501a84da6 👌 IMPROVE: 导出RTSP插件 2022-09-04 12:43:42 +08:00
dexter
7d08e06922 兼容sdp中没有包含sps和pps的情况 2022-08-21 14:49:54 +08:00
dexter
754a28e506 更新依赖版本 2022-07-29 20:43:39 +08:00
dexter
9b058153d2 增加强制指定拉流协议的配置 2022-07-23 11:59:26 +08:00
dexter
ae37279dd1 aler9未处理回调中带有err的情况 2022-07-03 01:14:23 +08:00
dexter
93d6eedff2 适配engine 4.4.0 2022-06-25 20:11:32 +08:00
dexter
2c1d908d7e 跟随引擎4.3.0版本 2022-06-19 23:44:28 +08:00
dexter
ced54a94a4 添加序列化屏蔽字段 2022-06-19 15:30:06 +08:00
dexter
f9bc450d01 跟随aler9升级 2022-06-05 21:09:37 +08:00
dexter
44fb77d121 去掉g711代码 2022-05-27 13:42:06 +08:00
dexter
1b6981cccb 使用官方创建的g711 2022-05-27 12:41:00 +08:00
dexter
2cd295d32c payloadType推拉对应 2022-05-26 20:35:27 +08:00
dexter
57ec489fef engine已实现等待track功能 2022-05-26 11:20:11 +08:00
dexter
a2100768b4 rtp降为v1 2022-05-15 16:32:45 +08:00
dexter
76956b16d1 对推流可能无法解析的情况进行报错 2022-05-10 21:58:35 +08:00
dexter
91e1726920 暂时修复向远程推流 2022-05-10 15:30:14 +08:00
dexter
4a0da71ee9 修改推流 2022-05-09 22:03:55 +08:00
langhuihui
701d55469d update readme 2022-05-04 21:38:20 +08:00
langhuihui
e273d0010e 将pcma的payloadType设置为8 2022-05-03 22:28:21 +08:00
langhuihui
96834e26a1 加上空格 2022-05-03 22:24:07 +08:00
dexter
7d0451c204 优化代码 2022-04-24 09:55:37 +08:00
langhuihui
c7c8858d36 添加API接口 2022-04-05 21:19:08 +08:00
dexter
731521f771 升级playblock 2022-03-27 11:33:34 +08:00
dexter
17334dd106 发布功能完善 2022-03-20 00:16:16 +08:00
dexter
2d9838bdfa 加上client逻辑 2022-03-19 01:15:19 +08:00
dexter
bd5a146ea6 v4 update 2022-03-18 01:24:32 +08:00
dexter
e411d30e91 Merge pull request #17 from jianglieshan/aler9
fix:修改rtsp插件作为服务端出流时,ssrc为0的bug
2022-01-16 13:12:11 +08:00
jianglieshan
709a4cee7b fix:修改rtsp插件作为服务端出流时,ssrc为0的bug 2022-01-15 16:50:40 +08:00
dexter
a90f52769d Merge pull request #16 from ziminghua/aler9
增加RTSPClient关闭的事件订阅,同步关闭客户端连接
2022-01-11 17:00:40 +08:00
訾明华
3764a26bbd 增加RTSPClient关闭的事件订阅,同步关闭客户端连接
增加RTSPClient关闭的事件订阅,同步关闭客户端连接
2022-01-11 16:52:14 +08:00
dexter
2533ab2604 Merge pull request #15 from ziminghua/aler9
多slice的情况下,同步同一帧的时间戳
2022-01-11 11:40:38 +08:00
訾明华
db07f0d588 多slice的情况下,同步同一帧的时间戳
`vpacketer.Packetize`再打包的过程中会把当前的timestamp+samples作为下一次打包的时间戳,如果多slice会连续传递samples导致同一帧的时间戳不一致
2022-01-11 11:34:29 +08:00
dexter
f110513d70 增加配置项ReadBufferSize 2021-12-29 22:59:45 +08:00
dexter
8901f4c117 修复bug 2021-12-29 22:16:11 +08:00
dexter
2f7c2de352 增加读取缓存大小,设置Mark标志位 2021-12-29 20:18:12 +08:00
dexter
af053bb5e6 对处理回调判空 2021-12-27 20:42:06 +08:00
dexter
bed7ba8a87 修复一个低级错误 2021-12-22 16:32:06 +08:00
dexter
0cbc4beb0f Merge pull request #13 from lhong1001/rtsp-syld
modified by syld 2021-12-20
2021-12-20 18:24:49 +08:00
root
edbfc07275 modified by syld 2021-12-20 2021-12-20 17:43:08 +08:00
dexter
329f93022e 修复流终止时仍然在拉流的bug 2021-12-14 14:21:52 +08:00
dexter
4895f2ec42 修复获取rtsp列表信息 2021-12-13 10:17:54 +08:00
dexter
9eb117811d 改名 2021-11-28 23:08:13 +08:00
dexter
00ecd3469f 每次重连切换连接方式 2021-11-23 12:40:21 +08:00
dexter
4107d31c79 默认拉tcp 2021-11-19 21:24:30 +08:00
dexter
5094fd0db7 加入转推功能 2021-11-18 19:29:31 +08:00
dexter
ef106e42f8 跟随升级gotsplib 2021-11-18 19:05:06 +08:00
dexter
0ac9513920 更新readme 2021-11-16 19:14:23 +08:00
dexter
a900613c70 初步改造完成 2021-11-16 19:06:24 +08:00
dexter
ac8aa96350 format 2021-10-06 09:22:59 +08:00
dexter
f267b1ca52 rtp依赖1.6.5不能用1.7版本 2021-08-08 08:07:22 +08:00
dexter
229370c083 更改类型适配pion的rtp类型升级 2021-08-08 07:40:52 +08:00
dexter
bb1e8ba1d8 适配3.3 2021-08-07 22:00:28 +08:00
dexter
8cf3e0c0fc 增加对publisher的非空判断 2021-08-04 15:27:55 +08:00
dexter
1ecb45d904 修改readme 2021-08-03 15:33:55 +08:00
dexter
3ea5bb7f27 更新readme 2021-08-02 09:21:38 +08:00
langhuihui
9aec4ec4be 防止json循环引用 2021-07-24 11:38:24 +08:00
langhuihui
da2fc9d462 更新重连逻辑 2021-07-24 09:38:22 +08:00
李宇翔
f68a3ee14b 实现rtsp拉流播放 2021-07-19 20:07:01 +08:00
langhuihui
a2f5cb87b1 修复音频初始化问题 2021-07-12 23:24:04 +08:00
langhuihui
5cdbc220de 修改rtsp自动拉流配置结构 2021-07-11 21:43:15 +08:00
langhuihui
f0a00f3db9 更新readme 2021-07-10 17:52:50 +08:00
langhuihui
fd8ebcd87c 内存复制 2021-07-09 22:50:33 +08:00
langhuihui
cc731a25f0 适配3.1 2021-07-09 08:18:19 +08:00
dexter
ba9f39853f Merge pull request #9 from dwdcth/v3
修复sps pps vps为空
2021-06-24 17:29:20 +08:00
banshan
0c8bd62e81 修复sps pps vps为空 2021-06-24 16:35:57 +08:00
李宇翔
dfe462a7d1 修复对Codec判断 2021-06-23 17:54:53 +08:00
李宇翔
cc7b899922 优化track设定 2021-06-23 15:57:44 +08:00
langhuihui
b0c3cdb21a 适配引擎版本升级 2021-06-15 08:06:40 +08:00
李宇翔
d08230bf0c v3去除UI 2021-03-30 18:52:30 +08:00
dexter
8a7fdedc0f Merge pull request #8 from dwdcth/patch-1
embed
2021-03-20 12:53:07 +08:00
banshan
b7d59b0198 embed 2021-03-19 14:22:34 +08:00
dwdcth
dc65348ccb Update go.mod 2021-03-19 14:13:53 +08:00
langhuihui
7fa6d0dcce 修改API 2021-02-26 22:03:50 +08:00
langhuihui
0689154012 适配3.0 2021-02-23 13:23:39 +08:00
langhuihui
2e39eabcba 适配3.0 2021-02-17 21:54:37 +08:00
langhuihui
a9cb4cd853 增加cors头 2020-11-16 21:23:16 +08:00
langhuihui
7e61ba71f7 怎加初始拉流功能 2020-10-01 20:12:26 +08:00
langhuihui
d6384dcbd5 版本更新 2020-09-23 23:04:07 +08:00
langhuihui
2159a6fd9b 解决rtsp推流无视频时的报错 2020-09-23 22:55:52 +08:00
langhuihui
02f3e91085 对其他音频的支持 2020-09-20 15:54:27 +08:00
langhuihui
7f40078b50 添加对engine版本的依赖 2020-08-29 08:00:25 +08:00
dexter
bb563d64c7 Merge pull request #5 from ourfor-pp/master
修复保活请求的bug
2020-08-29 07:48:16 +08:00
mqh
f7cb146b89 修复client.Session未保存,导致保活请求未携带session的bug 2020-08-28 17:05:45 +08:00
dexter
9bb49cb9f7 Merge pull request #4 from ourfor-pp/master
修改保活请求
2020-08-28 13:53:48 +08:00
mqh
087d1aab4d 增加basic登录(大华录像机测试验证) 2020-08-28 09:56:01 +08:00
mqh
f949464328 Merge branch 'master' of https://github.com/ourfor-pp/plugin-rtsp 2020-08-28 09:33:53 +08:00
mqh
d89f1e2405 将保活请求由OPTIONS改为GET_PARAMETER(来自VLC保活参考) 2020-08-28 09:26:57 +08:00
langhuihui
1d3fbfc20b 增加对纯音频的播放的支持 2020-08-27 08:50:45 +08:00
dexter
fd64a69a12 Merge pull request #2 from zbjlala/master
master
2020-08-26 22:17:37 +08:00
zbj
0e4406ad14 [fix]宇视摄像头DESCRIBE 有两个RTSP流 一个video matedata 需要两个SETUP才可播放 2020-08-25 11:55:49 +08:00
zbj
22f33886a9 [fix]宇视摄像头不支持该OPTIONS操作 551 2020-08-25 11:44:54 +08:00
langhuihui
8b1892209d 增加5分钟重连机制 2020-07-12 10:40:02 +08:00
langhuihui
2e9cf9a4ca 重连机制修复 2020-07-11 21:54:59 +08:00
langhuihui
67da93d8e2 增加重连时的判断 2020-07-09 22:04:00 +08:00
unknown
cb733b368f 增加重连功能 2020-07-09 20:06:35 +08:00
langhuihui
fadeccddab 更新依赖engine的版本 2020-06-09 07:12:20 +08:00
langhuihui
93df7632a6 修正升级带来的bug 2020-06-09 07:09:25 +08:00
langhuihui
53c4788df2 改用RTP插件 2020-05-31 10:01:29 +08:00
langhuihui
f5bdd6a298 内存复用 2020-05-24 22:58:38 +08:00
李宇翔
eaddc60775 过滤开头的NonIDR 2020-05-21 18:16:56 +08:00
langhuihui
655170cb24 修复中止拉流的操作 2020-05-20 09:55:39 +08:00
李宇翔
55bd2ce785 增加中止操作 2020-05-19 19:25:44 +08:00
28 changed files with 1039 additions and 12839 deletions

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
.vscode
node_modules

70
README.en.md Normal file
View File

@@ -0,0 +1,70 @@
_[简体中文](https://github.com/Monibuca/plugin-rtsp) | English_
# RTSP Plugin
The RTSP plugin provides the ability to push and pull the RTSP protocol and also to push and pull the RTSP protocol to remote servers.
## Plugin address
https://github.com/Monibuca/plugin-rtsp
## Plugin introduction
```go
import (
_ "m7s.live/plugin/rtsp/v4"
)
```
## Push and Pull address form
```
rtsp://localhost/live/test
```
- `localhost` is the m7s server domain name or IP address, and the default port `554` can be omitted, otherwise it is required to be written.
- `live` represents `appName`
- `test` represents `streamName`
- `live/test` in m7s will serve as the stream identity.
For example, push stream to m7s through ffmpeg
```bash
ffmpeg -i [video source] -c:v h264 -c:a aac -f rtsp rtsp://localhost/live/test
```
This will create a stream named `live/test` inside m7s.
If the `live/test` stream already exists in m7s, then you can use the RTSP protocol to play it.
```bash
ffplay rtsp://localhost/live/test
```
## Configuration
```yaml
rtsp:
publish: # Refer to the global configuration format
subscribe: # Refer to the global configuration format
pull: # Format reference document https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE
push: # Format reference document https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE
listenaddr: :554
udpaddr: :8000
rtcpaddr: :8001
readbuffercount: 2048
writebuffercount: 2048
```
:::tip Configuration override
publish and subscribe, any section not configured will use global configuration.
:::
## API
### `rtsp/api/list`
Get all RTSP streams
### `rtsp/api/pull?target=[RTSP address]&streamPath=[Stream identity]&save=[0|1|2]`
Pull the RTSP to m7s from a remote server
- save meaning: 0, do not save; 1, save to pullonstart; 2, save to pullonsub
- The RTSP address needs to be urlencoded to prevent special characters from affecting parsing
### `rtsp/api/push?target=[RTSP address]&streamPath=[Stream identity]`
Push local streams to remote servers

View File

@@ -1,26 +1,68 @@
# Monibuca 的RTSP 插件
_[English](https://github.com/Monibuca/plugin-rtsp/blob/v4/README.en.md) | 简体中文_
# RTSP插件
rtsp插件提供rtsp协议的推拉流能力以及向远程服务器推拉rtsp协议的能力。
## 插件地址
主要功能是提供RTSP的端口监听接受RTSP推流以及对RTSP地址进行拉流转发
https://github.com/Monibuca/plugin-rtsp
## 插件名称
## 插件引入
```go
import (
_ "m7s.live/plugin/rtsp/v4"
)
```
RTSP
## 推拉地址形式
```
rtsp://localhost/live/test
```
- `localhost`是m7s的服务器域名或者IP地址默认端口`554`可以不写,否则需要写
- `live`代表`appName`
- `test`代表`streamName`
- m7s中`live/test`将作为`streamPath`为流的唯一标识
例如通过ffmpeg向m7s进行推流
```bash
ffmpeg -i [视频源] -c:v h264 -c:a aac -f rtsp rtsp://localhost/live/test
```
会在m7s内部形成一个名为live/test的流
如果m7s中已经存在live/test流的话就可以用rtsp协议进行播放
```bash
ffplay rtsp://localhost/live/test
```
## 配置
```toml
[RTSP]
ListenAddr = ":554"
BufferLength = 2048
AutoPull = false
RemoteAddr = "rtsp://localhost/${streamPath}"
```yaml
rtsp:
publish: # 参考全局配置格式
subscribe: # 参考全局配置格式
pull: # 格式参考文档 https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE
push: # 格式参考文档 https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE
listenaddr: :554
udpaddr: :8000
rtcpaddr: :8001
readbuffercount: 2048 # 读取缓存队列大小
writebuffercount: 2048 # 写出缓存队列大小
```
- ListenAddr 是监听端口可以将rtsp流推到Monibuca中
- BufferLength是指解析拉取的rtp包的缓冲大小
- AutoPull是指当有用户订阅一个新流的时候自动向远程拉流转发
- RemoteAddr 指远程拉流地址,其中${streamPath}是占位符,实际使用流路径替换。
:::tip 配置覆盖
publish
subscribe
两项中未配置部分将使用全局配置
:::
## API
### `rtsp/api/list`
获取所有rtsp流
## 使用方法(拉流转发)
```go
new(RTSP).PullStream("live/user1","rtsp://xxx.xxx.xxx.xxx/live/user1")
```
### `rtsp/api/pull?target=[RTSP地址]&streamPath=[流标识]&save=[0|1|2]`
从远程拉取rtsp到m7s中
- save含义0、不保存1、保存到pullonstart2、保存到pullonsub
- RTSP地址需要进行urlencode 防止其中的特殊字符影响解析
### `rtsp/api/push?target=[RTSP地址]&streamPath=[流标识]`
将本地的流推送到远端

665
client.go
View File

@@ -1,556 +1,169 @@
package rtsp
import (
"bufio"
"bytes"
"crypto/md5"
"encoding/binary"
"fmt"
. "github.com/Monibuca/engine/v2"
"github.com/pixelbender/go-sdp/sdp"
"io"
"context"
"net"
"net/url"
"regexp"
"strconv"
"strings"
"time"
"github.com/bluenviron/gortsplib/v4"
"github.com/bluenviron/gortsplib/v4/pkg/base"
"github.com/bluenviron/gortsplib/v4/pkg/url"
"go.uber.org/zap"
"m7s.live/engine/v4"
)
// PullStream 从外部拉流
func (rtsp *RTSP) PullStream(streamPath string, rtspUrl string) (result bool) {
if result = rtsp.Publisher.Publish(streamPath); result {
rtsp.Stream.Type = "RTSP"
rtsp.RTSPInfo.StreamInfo = &rtsp.Stream.StreamInfo
rtsp.TransType = TRANS_TYPE_TCP
rtsp.vRTPChannel = 0
rtsp.vRTPControlChannel = 1
rtsp.aRTPChannel = 2
rtsp.aRTPControlChannel = 3
rtsp.URL = rtspUrl
if err := rtsp.requestStream();err != nil {
rtsp.Close()
return false
}
go rtsp.startStream()
collection.Store(streamPath, rtsp)
// go rtsp.run()
}
return
type RTSPClient struct {
*gortsplib.Client `json:"-" yaml:"-"`
gortsplib.Transport
DialContext func(ctx context.Context, network, address string) (net.Conn, error) `json:"-" yaml:"-"`
}
func DigestAuth(authLine string, method string, URL string) (string, error) {
l, err := url.Parse(URL)
if err != nil {
return "", fmt.Errorf("Url parse error:%v,%v", URL, err)
}
realm := ""
nonce := ""
realmRex := regexp.MustCompile(`realm="(.*?)"`)
result1 := realmRex.FindStringSubmatch(authLine)
nonceRex := regexp.MustCompile(`nonce="(.*?)"`)
result2 := nonceRex.FindStringSubmatch(authLine)
if len(result1) == 2 {
realm = result1[1]
} else {
return "", fmt.Errorf("auth error : no realm found")
}
if len(result2) == 2 {
nonce = result2[1]
} else {
return "", fmt.Errorf("auth error : no nonce found")
}
// response= md5(md5(username:realm:password):nonce:md5(public_method:url));
username := l.User.Username()
password, _ := l.User.Password()
l.User = nil
if l.Port() == "" {
l.Host = fmt.Sprintf("%s:%s", l.Host, "554")
}
md5UserRealmPwd := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", username, realm, password))))
md5MethodURL := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s", method, l.String()))))
response := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", md5UserRealmPwd, nonce, md5MethodURL))))
Authorization := fmt.Sprintf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"", username, realm, nonce, l.String(), response)
return Authorization, nil
type RTSPPuller struct {
RTSPPublisher
engine.Puller
RTSPClient
}
func (client *RTSP) checkAuth(method string, resp *Response) (string, error) {
if resp.StatusCode == 401 {
// need auth.
AuthHeaders := resp.Header["WWW-Authenticate"]
auths, ok := AuthHeaders.([]string)
if ok {
for _, authLine := range auths {
if strings.IndexAny(authLine, "Digest") == 0 {
// realm="HipcamRealServer",
// nonce="3b27a446bfa49b0c48c3edb83139543d"
client.authLine = authLine
return DigestAuth(authLine, method, client.URL)
} else if strings.IndexAny(authLine, "Basic") == 0 {
// not support yet
// TODO..
}
}
return "", fmt.Errorf("auth error")
} else {
authLine, _ := AuthHeaders.(string)
if strings.IndexAny(authLine, "Digest") == 0 {
client.authLine = authLine
return DigestAuth(authLine, method, client.URL)
} else if strings.IndexAny(authLine, "Basic") == 0 {
// not support yet
// TODO..
return "", fmt.Errorf("not support Basic auth yet")
}
}
}
return "", nil
}
func (client *RTSP) requestStream() (err error) {
timeout := time.Duration(5) * time.Second
l, err := url.Parse(client.URL)
if err != nil {
return err
}
if strings.ToLower(l.Scheme) != "rtsp" {
err = fmt.Errorf("RTSP url is invalid")
return err
}
if strings.ToLower(l.Hostname()) == "" {
err = fmt.Errorf("RTSP url is invalid")
return err
}
port := l.Port()
if len(port) == 0 {
port = "554"
}
conn, err := net.DialTimeout("tcp", l.Hostname()+":"+port, timeout)
if err != nil {
// handle error
return err
}
networkBuffer := 204800
timeoutConn := RichConn{
conn,
timeout,
}
client.Conn = &timeoutConn
client.connRW = bufio.NewReadWriter(bufio.NewReaderSize(&timeoutConn, networkBuffer), bufio.NewWriterSize(&timeoutConn, networkBuffer))
headers := make(map[string]string)
headers["Require"] = "implicit-play"
// An OPTIONS request returns the request types the server will accept.
resp, err := client.Request("OPTIONS", headers)
if err != nil {
if resp != nil {
Authorization, _ := client.checkAuth("OPTIONS", resp)
if len(Authorization) > 0 {
headers := make(map[string]string)
headers["Require"] = "implicit-play"
headers["Authorization"] = Authorization
// An OPTIONS request returns the request types the server will accept.
resp, err = client.Request("OPTIONS", headers)
}
if err != nil {
return err
}
} else {
return err
}
}
// A DESCRIBE request includes an RTSP URL (rtsp://...), and the type of reply data that can be handled. This reply includes the presentation description,
// typically in Session Description Protocol (SDP) format. Among other things, the presentation description lists the media streams controlled with the aggregate URL.
// In the typical case, there is one media stream each for audio and video.
headers = make(map[string]string)
headers["Accept"] = "application/sdp"
resp, err = client.Request("DESCRIBE", headers)
if err != nil {
if resp != nil {
authorization, _ := client.checkAuth("DESCRIBE", resp)
if len(authorization) > 0 {
headers := make(map[string]string)
headers["Authorization"] = authorization
headers["Accept"] = "application/sdp"
resp, err = client.Request("DESCRIBE", headers)
}
if err != nil {
return err
}
} else {
return err
}
}
_sdp, err := sdp.ParseString(resp.Body)
if err != nil {
return err
}
client.Sdp = _sdp
client.SDPRaw = resp.Body
client.SDPMap = ParseSDP(client.SDPRaw)
session := ""
for _, media := range _sdp.Media {
switch media.Type {
case "video":
client.VControl = media.Attributes.Get("control")
client.VCodec = media.Format[0].Name
client.SPS = client.SDPMap["video"].SpropParameterSets[0]
client.PPS = client.SDPMap["video"].SpropParameterSets[1]
var _url = ""
if strings.Index(strings.ToLower(client.VControl), "rtsp://") == 0 {
_url = client.VControl
} else {
_url = strings.TrimRight(client.URL, "/") + "/" + strings.TrimLeft(client.VControl, "/")
}
headers = make(map[string]string)
if client.TransType == TRANS_TYPE_TCP {
headers["Transport"] = fmt.Sprintf("RTP/AVP/TCP;unicast;interleaved=%d-%d", client.vRTPChannel, client.vRTPControlChannel)
} else {
if client.UDPServer == nil {
client.UDPServer = &UDPServer{Session: client}
}
//RTP/AVP;unicast;client_port=64864-64865
err = client.UDPServer.SetupVideo()
if err != nil {
Printf("Setup video err.%v", err)
return err
}
headers["Transport"] = fmt.Sprintf("RTP/AVP/UDP;unicast;client_port=%d-%d", client.UDPServer.VPort, client.UDPServer.VControlPort)
client.Conn.timeout = 0 // UDP ignore timeout
}
if session != "" {
headers["Session"] = session
}
Printf("Parse DESCRIBE response, VIDEO VControl:%s, VCode:%s, url:%s,Session:%s,vRTPChannel:%d,vRTPControlChannel:%d", client.VControl, client.VCodec, _url, session, client.vRTPChannel, client.vRTPControlChannel)
resp, err = client.RequestWithPath("SETUP", _url, headers, true)
if err != nil {
return err
}
session, _ = resp.Header["Session"].(string)
case "audio":
client.AControl = media.Attributes.Get("control")
client.ACodec = media.Format[0].Name
client.AudioSpecificConfig = client.SDPMap["audio"].Config
var _url = ""
if strings.Index(strings.ToLower(client.AControl), "rtsp://") == 0 {
_url = client.AControl
} else {
_url = strings.TrimRight(client.URL, "/") + "/" + strings.TrimLeft(client.AControl, "/")
}
headers = make(map[string]string)
if client.TransType == TRANS_TYPE_TCP {
headers["Transport"] = fmt.Sprintf("RTP/AVP/TCP;unicast;interleaved=%d-%d", client.aRTPChannel, client.aRTPControlChannel)
} else {
if client.UDPServer == nil {
client.UDPServer = &UDPServer{Session: client}
}
err = client.UDPServer.SetupAudio()
if err != nil {
Printf("Setup audio err.%v", err)
return err
}
headers["Transport"] = fmt.Sprintf("RTP/AVP/UDP;unicast;client_port=%d-%d", client.UDPServer.APort, client.UDPServer.AControlPort)
client.Conn.timeout = 0 // UDP ignore timeout
}
if session != "" {
headers["Session"] = session
}
Printf("Parse DESCRIBE response, AUDIO AControl:%s, ACodec:%s, url:%s,Session:%s, aRTPChannel:%d,aRTPControlChannel:%d", client.AControl, client.ACodec, _url, session, client.aRTPChannel, client.aRTPControlChannel)
resp, err = client.RequestWithPath("SETUP", _url, headers, true)
if err != nil {
return err
}
session, _ = resp.Header["Session"].(string)
}
}
headers = make(map[string]string)
if session != "" {
headers["Session"] = session
}
resp, err = client.Request("PLAY", headers)
if err != nil {
return err
func (p *RTSPClient) Close() error {
if p.Client != nil {
p.Client.Close()
}
return nil
}
func (client *RTSP) startStream() {
//startTime := time.Now()
//loggerTime := time.Now().Add(-10 * time.Second)
defer client.Stop()
for {
//if client.OptionIntervalMillis > 0 {
// if time.Since(startTime) > time.Duration(client.OptionIntervalMillis)*time.Millisecond {
// startTime = time.Now()
// headers := make(map[string]string)
// headers["Require"] = "implicit-play"
// // An OPTIONS request returns the request types the server will accept.
// if err := client.RequestNoResp("OPTIONS", headers); err != nil {
// // ignore...
// }
// }
//}
b, err := client.connRW.ReadByte()
if err != nil {
Printf("client.connRW.ReadByte err:%v", err)
func (p *RTSPClient) Disconnect() {
if p.Client != nil {
p.Client.Close()
}
}
func (p *RTSPPuller) Connect() error {
client := &gortsplib.Client{
DialContext: p.DialContext,
AnyPortEnable: true,
}
p.Transport = gortsplib.TransportTCP
client.Transport = &p.Transport
// parse URL
u, err := url.Parse(p.RemoteURL)
if err != nil {
return err
}
// connect to the server
if err = client.Start(u.Scheme, u.Host); err != nil {
return err
}
p.Client = client
p.SetIO(p)
return nil
}
func (p *RTSPPuller) Pull() (err error) {
u, _ := url.Parse(p.RemoteURL)
var res *base.Response
if rtspConfig.SendOptions {
if res, err = p.Options(u); err != nil {
p.Error("Options", zap.Error(err))
return
}
switch b {
case 0x24: // rtp
header := make([]byte, 4)
header[0] = b
_, err := io.ReadFull(client.connRW, header[1:])
if err != nil {
Printf("io.ReadFull err:%v", err)
return
}
channel := int(header[1])
length := binary.BigEndian.Uint16(header[2:])
content := make([]byte, length)
_, err = io.ReadFull(client.connRW, content)
if err != nil {
Printf("io.ReadFull err:%v", err)
return
}
rtpBuf := content
var pack *RTPPack
switch channel {
case client.aRTPChannel:
pack = &RTPPack{
Type: RTP_TYPE_AUDIO,
Buffer: rtpBuf,
}
case client.aRTPControlChannel:
pack = &RTPPack{
Type: RTP_TYPE_AUDIOCONTROL,
Buffer: rtpBuf,
}
case client.vRTPChannel:
pack = &RTPPack{
Type: RTP_TYPE_VIDEO,
Buffer: rtpBuf,
}
case client.vRTPControlChannel:
pack = &RTPPack{
Type: RTP_TYPE_VIDEOCONTROL,
Buffer: rtpBuf,
}
default:
Printf("unknow rtp pack type, channel:%v", channel)
continue
}
if pack == nil {
Printf("session tcp got nil rtp pack")
continue
}
//if client.debugLogEnable {
// rtp := ParseRTP(pack.Buffer)
// if rtp != nil {
// rtpSN := uint16(rtp.SequenceNumber)
// if client.lastRtpSN != 0 && client.lastRtpSN+1 != rtpSN {
// Printf("%s, %d packets lost, current SN=%d, last SN=%d\n", client.String(), rtpSN-client.lastRtpSN, rtpSN, client.lastRtpSN)
// }
// client.lastRtpSN = rtpSN
// }
//
// elapsed := time.Now().Sub(loggerTime)
// if elapsed >= 30*time.Second {
// Printf("%v read rtp frame.", client)
// loggerTime = time.Now()
// }
//}
client.InBytes += int(length + 4)
client.handleRTP(pack)
default: // rtsp
builder := bytes.Buffer{}
builder.WriteByte(b)
contentLen := 0
for {
line, prefix, err := client.connRW.ReadLine()
if err != nil {
Printf("client.connRW.ReadLine err:%v", err)
return
}
if len(line) == 0 {
if contentLen != 0 {
content := make([]byte, contentLen)
_, err = io.ReadFull(client.connRW, content)
if err != nil {
err = fmt.Errorf("Read content err.ContentLength:%d", contentLen)
return
}
builder.Write(content)
}
Printf("<<<[IN]\n%s", builder.String())
break
}
s := string(line)
builder.Write(line)
if !prefix {
builder.WriteString("\r\n")
}
if strings.Index(s, "Content-Length:") == 0 {
splits := strings.Split(s, ":")
contentLen, err = strconv.Atoi(strings.TrimSpace(splits[1]))
if err != nil {
Printf("strconv.Atoi err:%v, str:%v", err, splits[1])
return
}
}
}
}
}
}
func (client *RTSP) Request(method string, headers map[string]string) (*Response, error) {
l, err := url.Parse(client.URL)
p.Debug("Options", zap.Any("res", res))
// find published tracks
session, res, err := p.Describe(u)
if err != nil {
return nil, fmt.Errorf("Url parse error:%v", err)
}
l.User = nil
return client.RequestWithPath(method, l.String(), headers, true)
}
func (client *RTSP) RequestNoResp(method string, headers map[string]string) (err error) {
l, err := url.Parse(client.URL)
if err != nil {
return fmt.Errorf("Url parse error:%v", err)
}
l.User = nil
if _, err = client.RequestWithPath(method, l.String(), headers, false); err != nil {
p.Error("Describe", zap.Error(err))
return err
}
return nil
p.Debug("Describe", zap.Any("res", res))
p.session = session
err = p.SetTracks()
if err != nil {
p.Error("SetTracks", zap.Error(err))
return err
}
if err = p.SetupAll(session.BaseURL, session.Medias); err != nil {
p.Error("SetupAndPlay", zap.Error(err))
return err
}
p.OnPacketRTPAny(p.OnPacket)
res, err = p.Play(nil)
p.Debug("Play", zap.Any("res", res))
if err != nil {
p.Error("Play", zap.Error(err))
return err
}
return p.Wait()
}
func (client *RTSP) RequestWithPath(method string, path string, headers map[string]string, needResp bool) (resp *Response, err error) {
headers["User-Agent"] = client.Agent
if len(headers["Authorization"]) == 0 {
if len(client.authLine) != 0 {
Authorization, _ := DigestAuth(client.authLine, method, client.URL)
if len(Authorization) > 0 {
headers["Authorization"] = Authorization
}
}
type RTSPPusher struct {
RTSPSubscriber
engine.Pusher
RTSPClient
}
func (p *RTSPPusher) OnEvent(event any) {
switch v := event.(type) {
case engine.VideoRTP:
p.Client.WritePacketRTP(p.videoTrack, v.Packet)
case engine.AudioRTP:
p.Client.WritePacketRTP(p.audioTrack, v.Packet)
default:
p.RTSPSubscriber.OnEvent(event)
}
if len(client.Session) > 0 {
headers["Session"] = client.Session
}
func (p *RTSPPusher) Connect() error {
p.Client = &gortsplib.Client{
DialContext: p.DialContext,
WriteQueueSize: rtspConfig.WriteBufferCount,
}
client.Seq++
cseq := client.Seq
builder := bytes.Buffer{}
builder.WriteString(fmt.Sprintf("%s %s RTSP/1.0\r\n", method, path))
builder.WriteString(fmt.Sprintf("CSeq: %d\r\n", cseq))
for k, v := range headers {
builder.WriteString(fmt.Sprintf("%s: %s\r\n", k, v))
}
builder.WriteString(fmt.Sprintf("\r\n"))
s := builder.String()
Printf("[OUT]>>>\n%s", s)
_, err = client.connRW.WriteString(s)
p.Transport = gortsplib.TransportTCP
p.Client.Transport = &p.Transport
// parse URL
u, err := url.Parse(p.RemoteURL)
if err != nil {
p.Error("url.Parse", zap.Error(err))
return err
}
// connect to the server
if err = p.Client.Start(u.Scheme, u.Host); err != nil {
p.Error("Client.Start", zap.Error(err))
return err
}
p.SetIO(p)
if rtspConfig.SendOptions {
_, err = p.Client.Options(u)
}
return err
}
func (p *RTSPPusher) Push() (err error) {
var u *url.URL
u, err = url.Parse(p.RemoteURL)
// startTime := time.Now()
// for len(p.tracks) < 2 {
// if time.Sleep(time.Second); time.Since(startTime) > time.Second*10 {
// return fmt.Errorf("timeout")
// }
// }
var res *base.Response
if res, err = p.Announce(u, p.session); err != nil {
p.Error("Announce", zap.Error(err))
return
} else {
p.Debug("Announce", zap.Any("res", res))
}
err = p.SetupAll(u, p.session.Medias)
if err != nil {
p.Error("Setup", zap.Error(err))
return
}
client.connRW.Flush()
if !needResp {
return nil, nil
}
lineCount := 0
statusCode := 200
status := ""
sid := ""
contentLen := 0
respHeader := make(map[string]interface{})
var line []byte
builder.Reset()
for {
isPrefix := false
if line, isPrefix, err = client.connRW.ReadLine(); err != nil {
return
}
s := string(line)
builder.Write(line)
if !isPrefix {
builder.WriteString("\r\n")
}
if len(line) == 0 {
body := ""
if contentLen > 0 {
content := make([]byte, contentLen)
_, err = io.ReadFull(client.connRW, content)
if err != nil {
err = fmt.Errorf("Read content err.ContentLength:%d", contentLen)
return
}
body = string(content)
builder.Write(content)
}
resp = NewResponse(statusCode, status, strconv.Itoa(cseq), sid, body)
resp.Header = respHeader
Printf("<<<[IN]\n%s", builder.String())
if !(statusCode >= 200 && statusCode <= 300) {
err = fmt.Errorf("Response StatusCode is :%d", statusCode)
return
}
return
}
if lineCount == 0 {
splits := strings.Split(s, " ")
if len(splits) < 3 {
err = fmt.Errorf("StatusCode Line error:%s", s)
return
}
statusCode, err = strconv.Atoi(splits[1])
if err != nil {
return
}
status = splits[2]
}
lineCount++
splits := strings.Split(s, ":")
if len(splits) == 2 {
if val, ok := respHeader[splits[0]]; ok {
if slice, ok2 := val.([]string); ok2 {
slice = append(slice, strings.TrimSpace(splits[1]))
respHeader[splits[0]] = slice
} else {
str, _ := val.(string)
slice := []string{str, strings.TrimSpace(splits[1])}
respHeader[splits[0]] = slice
}
} else {
respHeader[splits[0]] = strings.TrimSpace(splits[1])
}
}
if strings.Index(s, "Session:") == 0 {
splits := strings.Split(s, ":")
sid = strings.TrimSpace(splits[1])
}
//if strings.Index(s, "CSeq:") == 0 {
// splits := strings.Split(s, ":")
// cseq, err = strconv.Atoi(strings.TrimSpace(splits[1]))
// if err != nil {
// err = fmt.Errorf("Atoi CSeq err. line:%s", s)
// return
// }
//}
if strings.Index(s, "Content-Length:") == 0 {
splits := strings.Split(s, ":")
contentLen, err = strconv.Atoi(strings.TrimSpace(splits[1]))
if err != nil {
return
}
}
if res, err = p.Record(); err != nil {
p.Error("Record", zap.Error(err))
return
} else {
p.Debug("Record", zap.Any("res", res))
}
p.PlayRTP()
return
}

52
go.mod
View File

@@ -1,11 +1,49 @@
module github.com/Monibuca/plugin-rtsp
module m7s.live/plugin/rtsp/v4
go 1.13
go 1.18
require (
github.com/Monibuca/engine/v2 v2.0.0
github.com/jinzhu/gorm v1.9.12 // indirect
github.com/pixelbender/go-sdp v1.0.0
github.com/reactivex/rxgo v1.0.0 // indirect
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf
github.com/bluenviron/gortsplib/v4 v4.6.2
github.com/bluenviron/mediacommon v1.5.1
github.com/pion/rtp v1.8.3
go.uber.org/zap v1.26.0
m7s.live/engine/v4 v4.15.2
)
require (
github.com/deepch/vdk v0.0.27 // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/pprof v0.0.0-20230309165930-d61513b1440d // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/logrusorgru/aurora/v4 v4.0.0 // indirect
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
github.com/mcuadros/go-defaults v1.2.0 // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.12 // indirect
github.com/pion/sdp/v3 v3.0.6 // indirect
github.com/pion/webrtc/v3 v3.2.20 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/q191201771/naza v0.30.48 // indirect
github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
github.com/quic-go/quic-go v0.38.1 // indirect
github.com/shirou/gopsutil/v3 v3.23.8 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yapingcat/gomedia v0.0.0-20230905155010-55b9713fcec1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/tools v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

323
go.sum
View File

@@ -1,82 +1,271 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/EasyDarwin/EasyDarwin v8.1.0+incompatible h1:Rr8dRbZtcJhiJvGx5Vs7IENM6RUUwGkZiIj5+WrNhm8=
github.com/EasyDarwin/EasyDarwin v8.1.0+incompatible/go.mod h1:xnmC+Q2+wugEDpQGxivSFNYPOhmNlIQHBfl0hMeriSU=
github.com/Monibuca/engine v1.2.1 h1:TJmC6eZA1lR1MScWgempZLiEZD4T6aY/nn/rlQ9UdK8=
github.com/Monibuca/engine v1.2.1/go.mod h1:WbDkXENLjcPjyjCR1Mix1GA+uAlwORkv/+8aMVrDX2g=
github.com/Monibuca/engine v1.2.2 h1:hNjsrZpOmui8lYhgCJ5ltJU8g/k0Rrdysx2tHNGGnbI=
github.com/Monibuca/engine/v2 v2.0.0 h1:8FjaScrtN8QdbcxO9zZYABMC0Re3I1O1T4p94zAXYb0=
github.com/Monibuca/engine/v2 v2.0.0/go.mod h1:34EYjjV15G6myuHOKaJkO7y5tJ1Arq/NfC9Weacr2mc=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/bluenviron/gortsplib/v4 v4.6.2 h1:CGIsxpnUFvSlIxnSFS0oFSSfwsHMmBCmYcrGAtIcwXc=
github.com/bluenviron/gortsplib/v4 v4.6.2/go.mod h1:dN1YjyPNMfy/NwC17Ga6MiIMiUoQfg5GL7LGsVHa0Jo=
github.com/bluenviron/mediacommon v1.5.1 h1:yYVF+ebqZOJh8yH+EeuPcAtTmWR66BqbJGmStxkScoI=
github.com/bluenviron/mediacommon v1.5.1/go.mod h1:Ij/kE1LEucSjryNBVTyPL/gBI0d6/Css3f5PyrM957w=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
github.com/falconray0704/gortmp v0.0.0-20170613085150-e3f9bb02c7c8 h1:Bkx+0neYCcHW7BUeVCbR2GOn47NesdImh8nHHOKccD4=
github.com/falconray0704/gortmp v0.0.0-20170613085150-e3f9bb02c7c8/go.mod h1:/JBZajtCDe9Z4j84v5QWo4PLn1K6jcBHh6qXN/bm/vw=
github.com/funny/slab v0.0.0-20180511031532-b1fad5e5d478 h1:Db9StoJ6RZN3YttC0Pm0I4Y5izITRYch3RMbT59BYN0=
github.com/funny/slab v0.0.0-20180511031532-b1fad5e5d478/go.mod h1:0j1+svBH8ABEIPdUP0AIg4qedsybnXGJBakCEw8cfoo=
github.com/funny/utest v0.0.0-20161029064919-43870a374500 h1:Z0r1CZnoIWFB/Uiwh1BU5FYmuFe6L5NPi6XWQEmsTRg=
github.com/funny/utest v0.0.0-20161029064919-43870a374500/go.mod h1:mUn39tBov9jKnTWV1RlOYoNzxdBFHiSzXWdY1FoNGGg=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deepch/vdk v0.0.27 h1:j/SHaTiZhA47wRpaue8NRp7P9xwOOO/lunxrDJBwcao=
github.com/deepch/vdk v0.0.27/go.mod h1:JlgGyR2ld6+xOIHa7XAxJh+stSDBAkdNvIPkUIdIywk=
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/jinzhu/gorm v1.9.12 h1:Drgk1clyWT9t9ERbzHza6Mj/8FY/CqMyVzOiHviMo6Q=
github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs=
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw=
github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/pixelbender/go-sdp v1.0.0 h1:hLP2ALBN4sLpgp2r3EDcFUSN3AyOkg1jonuWEJniotY=
github.com/pixelbender/go-sdp v1.0.0/go.mod h1:6IBlz9+BrUHoFTea7gcp4S54khtOhjCW/nVDLhmZBAs=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20230309165930-d61513b1440d h1:um9/pc7tKMINFfP1eE7Wv6PRGXlcCSJkVajF7KJw3uQ=
github.com/google/pprof v0.0.0-20230309165930-d61513b1440d/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/logrusorgru/aurora/v4 v4.0.0 h1:sRjfPpun/63iADiSvGGjgA1cAYegEWMPCJdUpJYn9JA=
github.com/logrusorgru/aurora/v4 v4.0.0/go.mod h1:lP0iIa2nrnT/qoFXcOZSrZQpJ1o6n2CUf/hyHi2Q4ZQ=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a h1:N9zuLhTvBSRt0gWSiJswwQ2HqDmtX/ZCDJURnKUt1Ik=
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE=
github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc=
github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0=
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
github.com/pion/ice/v2 v2.3.11/go.mod h1:hPcLC3kxMa+JGRzMHqQzjoSj3xtE9F+eoncmXLlCL4E=
github.com/pion/interceptor v0.1.18/go.mod h1:tpvvF4cPM6NGxFA1DUMbhabzQBxdWMATDGEUYOR9x6I=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pion/mdns v0.0.8/go.mod h1:hYE72WX8WDveIhg7fmXgMKivD3Puklk0Ymzog0lSyaI=
github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA=
github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8=
github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I=
github.com/pion/rtcp v1.2.12 h1:bKWiX93XKgDZENEXCijvHRU/wRifm6JV5DGcH6twtSM=
github.com/pion/rtcp v1.2.12/go.mod h1:sn6qjxvnwyAkkPzPULIbVqSKI5Dv54Rv7VG0kNxh9L4=
github.com/pion/rtp v1.8.1/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU=
github.com/pion/rtp v1.8.3 h1:VEHxqzSVQxCkKDSHro5/4IUUG1ea+MFdqR2R3xSpNU8=
github.com/pion/rtp v1.8.3/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU=
github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0=
github.com/pion/sctp v1.8.8/go.mod h1:igF9nZBrjh5AtmKc7U30jXltsFHicFCXSmWA2GWRaWs=
github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw=
github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw=
github.com/pion/srtp/v2 v2.0.17/go.mod h1:y5WSHcJY4YfNB/5r7ca5YjHeIr1H3LM1rKArGGs8jMc=
github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8=
github.com/pion/transport v0.14.1/go.mod h1:4tGmbk00NeYA3rUa9+n+dzCCoKkcy3YlYb99Jn2fNnI=
github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g=
github.com/pion/transport/v2 v2.2.2/go.mod h1:OJg3ojoBJopjEeECq2yJdXH9YVrUJ1uQ++NjXLOUorc=
github.com/pion/transport/v2 v2.2.3/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0=
github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
github.com/pion/webrtc/v3 v3.2.20 h1:BQJiXQsJq9LgLp3op7rLy1y8d2WD+LtiS9cpY0uQ22A=
github.com/pion/webrtc/v3 v3.2.20/go.mod h1:vVURQTBOG5BpWKOJz3nlr23NfTDeyKVmubRNqzQp+Tg=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/reactivex/rxgo v1.0.0 h1:qpT8/kVwAJDSeGsqx4oUXxgk3UCtAq/EreBGWYRxEcA=
github.com/reactivex/rxgo v1.0.0/go.mod h1:/S1ygE20oE1BvZGIwd3fXx/m6s6pOX5G6zmXg9ninlQ=
github.com/shirou/gopsutil v2.20.1+incompatible h1:oIq9Cq4i84Hk8uQAUOG3eNdI/29hBawGrD5YRl6JRDY=
github.com/shirou/gopsutil v2.20.1+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig=
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/q191201771/naza v0.30.48 h1:lbYUaa7A15kJKYwOiU4AbFS1Zo8oQwppl2tLEbJTqnw=
github.com/q191201771/naza v0.30.48/go.mod h1:n+dpJjQSh90PxBwxBNuifOwQttywvSIN5TkWSSYCeBk=
github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM=
github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE=
github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4=
github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
github.com/shirou/gopsutil/v3 v3.23.8 h1:xnATPiybo6GgdRoC4YoGnxXZFRc3dqQTGi73oLvvBrE=
github.com/shirou/gopsutil/v3 v3.23.8/go.mod h1:7hmCaBn+2ZwaZOr6jmPBZDfawwMGuo1id3C6aM8EDqQ=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf h1:Z2X3Os7oRzpdJ75iPqWZc0HeJWFYNCvKsfpQwFpRNTA=
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0=
github.com/zhangpeihao/goamf v0.0.0-20140409082417-3ff2c19514a8/go.mod h1:RZd/IqzNpFANwOB9rVmsnAYpo/6KesK4PqrN1a5cRgg=
github.com/zhangpeihao/log v0.0.0-20170117094621-62e921e41859/go.mod h1:OAvmouyIV28taMw4SC4+hSnouObQqQkTQNOhU3Zowl0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/yapingcat/gomedia v0.0.0-20230905155010-55b9713fcec1 h1:ilNIuDBR+UKA3qefiyWRoFufIFn3E4tgEXbBM4ILH28=
github.com/yapingcat/gomedia v0.0.0-20230905155010-55b9713fcec1/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd h1:GGJVjV8waZKRHrgwvtH66z9ZGVurTD1MT0n1Bb+q4aM=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
m7s.live/engine/v4 v4.15.2 h1:Uws658Ict2B8JojBG7fNmd2G2i63MlomsQ4npgNzF3g=
m7s.live/engine/v4 v4.15.2/go.mod h1:uKxjmsjU1WARUNowEkP83BSrJMUjGwkJrX5nPi6DGmE=

369
main.go
View File

@@ -1,313 +1,102 @@
package rtsp
import (
"bufio"
"bytes"
"fmt"
"log"
"net"
"net/http"
"strings"
"strconv"
"sync"
"time"
. "github.com/Monibuca/engine/v2"
. "github.com/Monibuca/engine/v2/avformat"
"github.com/Monibuca/engine/v2/util"
"github.com/pixelbender/go-sdp/sdp"
"github.com/teris-io/shortid"
"github.com/bluenviron/gortsplib/v4"
"go.uber.org/zap"
. "m7s.live/engine/v4"
"m7s.live/engine/v4/config"
"m7s.live/engine/v4/util"
)
var collection = sync.Map{}
var config = struct {
ListenAddr string
BufferLength int
AutoPull bool
RemoteAddr string
Timeout int
}{":554", 2048, true, "rtsp://localhost/${streamPath}", 0}
func init() {
InstallPlugin(&PluginConfig{
Name: "RTSP",
Type: PLUGIN_PUBLISHER | PLUGIN_HOOK,
Config: &config,
Run: runPlugin,
HotConfig: map[string]func(interface{}){
"AutoPull": func(value interface{}) {
config.AutoPull = value.(bool)
},
},
})
type RTSPConfig struct {
config.Publish
config.Subscribe
config.Pull
config.Push
ListenAddr string `default:":554" desc:"rtsp监听地址"`
UDPAddr string `default:":8000" desc:"udp rtp监听地址"`
RTCPAddr string `default:":8001" desc:"udp rtcp监听地址"`
WriteBufferCount int `default:"2048" desc:"rtsp写缓冲区大小"`
SendOptions bool `default:"true" desc:"是否发送options请求"`
sync.Map
server *gortsplib.Server
}
func runPlugin() {
OnSubscribeHooks.AddHook(func(s *Subscriber) {
if config.AutoPull && s.Publisher == nil {
new(RTSP).PullStream(s.StreamPath, strings.Replace(config.RemoteAddr, "${streamPath}", s.StreamPath, -1))
func (conf *RTSPConfig) OnEvent(event any) {
switch v := event.(type) {
case FirstConfig:
conf.server = &gortsplib.Server{
Handler: conf,
RTSPAddress: conf.ListenAddr,
UDPRTPAddress: conf.UDPAddr,
UDPRTCPAddress: conf.RTCPAddr,
MulticastIPRange: "224.1.0.0/16",
MulticastRTPPort: 8002,
MulticastRTCPPort: 8003,
WriteQueueSize: conf.WriteBufferCount,
}
})
http.HandleFunc("/rtsp/list", func(w http.ResponseWriter, r *http.Request) {
sse := util.NewSSE(w, r.Context())
var err error
for tick := time.NewTicker(time.Second); err == nil; <-tick.C {
var info []*RTSPInfo
collection.Range(func(key, value interface{}) bool {
rtsp := value.(*RTSP)
pinfo := &rtsp.RTSPInfo
//pinfo.BufferRate = len(rtsp.OutGoing) * 100 / config.BufferLength
info = append(info, pinfo)
return true
})
err = sse.WriteJSON(info)
if err := conf.server.Start(); err != nil {
RTSPPlugin.Error("server start", zap.Error(err))
RTSPPlugin.Disabled = true
}
})
http.HandleFunc("/rtsp/pull", func(w http.ResponseWriter, r *http.Request) {
targetURL := r.URL.Query().Get("target")
streamPath := r.URL.Query().Get("streamPath")
var err error
if err == nil {
new(RTSP).PullStream(streamPath, targetURL)
w.Write([]byte(`{"code":0}`))
} else {
w.Write([]byte(fmt.Sprintf(`{"code":1,"msg":"%s"}`, err.Error())))
for streamPath, url := range conf.PullOnStart {
if err := RTSPPlugin.Pull(streamPath, url, new(RTSPPuller), 0); err != nil {
RTSPPlugin.Error("pull", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err))
}
}
case SEpublish:
if remoteURL := conf.CheckPush(v.Target.Path); remoteURL != "" {
if err := RTSPPlugin.Push(v.Target.Path, remoteURL, new(RTSPPusher), false); err != nil {
RTSPPlugin.Error("push", zap.String("streamPath", v.Target.Path), zap.String("url", remoteURL), zap.Error(err))
}
}
case InvitePublish: //按需拉流
if remoteURL := conf.CheckPullOnSub(v.Target); remoteURL != "" {
if err := RTSPPlugin.Pull(v.Target, remoteURL, new(RTSPPuller), 0); err != nil {
RTSPPlugin.Error("pull", zap.String("streamPath", v.Target), zap.String("url", remoteURL), zap.Error(err))
}
}
})
if config.ListenAddr != "" {
log.Fatal(ListenRtsp(config.ListenAddr))
}
}
func ListenRtsp(addr string) error {
defer log.Println("rtsp server start!")
listener, err := net.Listen("tcp", addr)
var rtspConfig = &RTSPConfig{}
var RTSPPlugin = InstallPlugin(rtspConfig)
func filterStreams() (ss []*Stream) {
Streams.Range(func(key string, s *Stream) {
switch s.Publisher.(type) {
case *RTSPPublisher, *RTSPPuller:
ss = append(ss, s)
}
})
return
}
func (*RTSPConfig) API_list(w http.ResponseWriter, r *http.Request) {
util.ReturnFetchValue(filterStreams, w, r)
}
func (*RTSPConfig) API_Pull(rw http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
save, _ := strconv.Atoi(query.Get("save"))
err := RTSPPlugin.Pull(query.Get("streamPath"), query.Get("target"), new(RTSPPuller), save)
if err != nil {
return err
}
var tempDelay time.Duration
networkBuffer := 204800
timeoutMillis := config.Timeout
for {
conn, err := listener.Accept()
conn.(*net.TCPConn).SetNoDelay(false)
if err != nil {
if ne, ok := err.(net.Error); ok && ne.Temporary() {
if tempDelay == 0 {
tempDelay = 5 * time.Millisecond
} else {
tempDelay *= 2
}
if max := 1 * time.Second; tempDelay > max {
tempDelay = max
}
fmt.Printf("rtsp: Accept error: %v; retrying in %v", err, tempDelay)
time.Sleep(tempDelay)
continue
}
return err
}
tempDelay = 0
timeoutTCPConn := &RichConn{conn, time.Duration(timeoutMillis) * time.Millisecond}
go (&RTSP{
ID: shortid.MustGenerate(),
Conn: timeoutTCPConn,
connRW: bufio.NewReadWriter(bufio.NewReaderSize(timeoutTCPConn, networkBuffer), bufio.NewWriterSize(timeoutTCPConn, networkBuffer)),
Timeout: config.Timeout,
vRTPChannel: -1,
vRTPControlChannel: -1,
aRTPChannel: -1,
aRTPControlChannel: -1,
}).AcceptPush()
}
return nil
}
type RTSP struct {
Publisher
RTSPInfo
RTSPClientInfo
ID string
Conn *RichConn
connRW *bufio.ReadWriter
connWLock sync.RWMutex
Type SessionType
TransType TransType
SDPRaw string
SDPMap map[string]*SDPInfo
nonce string
closeOld bool
AControl string
VControl string
ACodec string
VCodec string
avcsent bool
aacsent bool
Timeout int
// stats info
fuBuffer []byte
//tcp channels
aRTPChannel int
aRTPControlChannel int
vRTPChannel int
vRTPControlChannel int
UDPServer *UDPServer
UDPClient *UDPClient
SPS []byte
PPS []byte
AudioSpecificConfig []byte
Auth func(string) string
}
type RTSPClientInfo struct {
Agent string
Session string
Sdp *sdp.Session
authLine string
Seq int
}
type RTSPInfo struct {
URL string
SyncCount int64
Header *string
BufferRate int
InBytes int
OutBytes int
StreamInfo *StreamInfo
}
type RichConn struct {
net.Conn
timeout time.Duration
}
func (conn *RichConn) Read(b []byte) (n int, err error) {
if conn.timeout > 0 {
conn.Conn.SetReadDeadline(time.Now().Add(conn.timeout))
util.ReturnError(util.APIErrorQueryParse, err.Error(), rw, r)
} else {
var t time.Time
conn.Conn.SetReadDeadline(t)
util.ReturnOK(rw, r)
}
return conn.Conn.Read(b)
}
func (conn *RichConn) Write(b []byte) (n int, err error) {
if conn.timeout > 0 {
conn.Conn.SetWriteDeadline(time.Now().Add(conn.timeout))
func (*RTSPConfig) API_Push(rw http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
err := RTSPPlugin.Push(query.Get("streamPath"), query.Get("target"), new(RTSPPusher), query.Has("save"))
if err != nil {
util.ReturnError(util.APIErrorQueryParse, err.Error(), rw, r)
} else {
var t time.Time
conn.Conn.SetWriteDeadline(t)
}
return conn.Conn.Write(b)
}
func (rtsp *RTSP) handleNALU(nalType byte, payload []byte, ts int64) {
rtsp.SyncCount++
vl := len(payload)
switch nalType {
// case NALU_SPS:
// r := bytes.NewBuffer([]byte{})
// r.Write(RTMP_AVC_HEAD)
// util.BigEndian.PutUint16(spsHead[1:], uint16(vl))
// r.Write(spsHead)
// r.Write(payload)
// case NALU_PPS:
// r := bytes.NewBuffer([]byte{})
// util.BigEndian.PutUint16(ppsHead[1:], uint16(vl))
// r.Write(ppsHead)
// r.Write(payload)
// rtsp.PushVideo(0, r.Bytes())
// avcsent = true
case NALU_IDR_Picture:
if !rtsp.avcsent {
r := bytes.NewBuffer([]byte{})
r.Write(RTMP_AVC_HEAD)
spsHead := []byte{0xE1, 0, 0}
util.BigEndian.PutUint16(spsHead[1:], uint16(len(rtsp.SPS)))
r.Write(spsHead)
r.Write(rtsp.SPS)
ppsHead := []byte{0x01, 0, 0}
util.BigEndian.PutUint16(ppsHead[1:], uint16(len(rtsp.PPS)))
r.Write(ppsHead)
r.Write(rtsp.PPS)
rtsp.PushVideo(0, r.Bytes())
rtsp.avcsent = true
}
r := bytes.NewBuffer([]byte{})
iframeHead := []byte{0x17, 0x01, 0, 0, 0}
util.BigEndian.PutUint24(iframeHead[2:], 0)
r.Write(iframeHead)
nalLength := []byte{0, 0, 0, 0}
util.BigEndian.PutUint32(nalLength, uint32(vl))
r.Write(nalLength)
r.Write(payload)
rtsp.PushVideo(uint32(ts), r.Bytes())
case NALU_Non_IDR_Picture:
r := bytes.NewBuffer([]byte{})
pframeHead := []byte{0x27, 0x01, 0, 0, 0}
util.BigEndian.PutUint24(pframeHead[2:], 0)
r.Write(pframeHead)
nalLength := []byte{0, 0, 0, 0}
util.BigEndian.PutUint32(nalLength, uint32(vl))
r.Write(nalLength)
r.Write(payload)
rtsp.PushVideo(uint32(ts), r.Bytes())
}
}
func (rtsp *RTSP) handleRTP(pack *RTPPack) {
data := pack.Buffer
switch pack.Type {
case RTP_TYPE_AUDIO:
if !rtsp.aacsent {
rtsp.PushAudio(0, append([]byte{0xAF, 0x00}, rtsp.AudioSpecificConfig...))
rtsp.aacsent = true
}
cc := data[0] & 0xF
rtphdr := 12 + cc*4
payload := data[rtphdr:]
auHeaderLen := (int16(payload[0]) << 8) + int16(payload[1])
auHeaderLen = auHeaderLen >> 3
auHeaderCount := int(auHeaderLen / 2)
var auLenArray []int
for iIndex := 0; iIndex < int(auHeaderCount); iIndex++ {
auHeaderInfo := (int16(payload[2+2*iIndex]) << 8) + int16(payload[2+2*iIndex+1])
auLen := auHeaderInfo >> 3
auLenArray = append(auLenArray, int(auLen))
}
startOffset := 2 + 2*auHeaderCount
for _, auLen := range auLenArray {
endOffset := startOffset + auLen
addHead := []byte{0xAF, 0x01}
rtsp.PushAudio(0, append(addHead, payload[startOffset:endOffset]...))
startOffset = startOffset + auLen
}
case RTP_TYPE_VIDEO:
cc := data[0] & 0xF
//rtp header
rtphdr := 12 + cc*4
//packet time
ts := (int64(data[4]) << 24) + (int64(data[5]) << 16) + (int64(data[6]) << 8) + (int64(data[7]))
//packet number
//packno := (int64(data[6]) << 8) + int64(data[7])
data = data[rtphdr:]
nalType := data[0] & 0x1F
if nalType >= 1 && nalType <= 23 {
rtsp.handleNALU(nalType, data, ts)
} else if nalType == 28 {
isStart := data[1]&0x80 != 0
isEnd := data[1]&0x40 != 0
nalType := data[1] & 0x1F
//nri := (data[1]&0x60)>>5
nal := data[0]&0xE0 | data[1]&0x1F
if isStart {
rtsp.fuBuffer = []byte{0}
}
rtsp.fuBuffer = append(rtsp.fuBuffer, data[2:]...)
if isEnd {
rtsp.fuBuffer[0] = nal
rtsp.handleNALU(nalType, rtsp.fuBuffer, ts)
}
}
util.ReturnOK(rw, r)
}
}

134
publisher.go Normal file
View File

@@ -0,0 +1,134 @@
package rtsp
import (
"strings"
"github.com/bluenviron/gortsplib/v4/pkg/description"
"github.com/bluenviron/gortsplib/v4/pkg/format"
"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
"github.com/pion/rtp"
"go.uber.org/zap"
. "m7s.live/engine/v4"
"m7s.live/engine/v4/codec"
"m7s.live/engine/v4/common"
. "m7s.live/engine/v4/track"
"m7s.live/engine/v4/util"
)
type RTSPPublisher struct {
Publisher
Tracks map[*description.Media]common.AVTrack `json:"-" yaml:"-"`
RTSPIO
}
func (p *RTSPPublisher) SetTracks() error {
p.Tracks = make(map[*description.Media]common.AVTrack, len(p.session.Medias))
defer func() {
for _, track := range p.Tracks {
p.Info("set track", zap.String("name", track.GetName()))
}
}()
for _, track := range p.session.Medias {
for _, forma := range track.Formats {
switch f := forma.(type) {
case *format.H264:
vt := p.VideoTrack
if vt == nil {
vt = p.CreateVideoTrack(codec.CodecID_H264, byte(f.PayloadType()))
}
p.Tracks[track] = vt
if len(f.SPS) > 0 {
vt.WriteSliceBytes(f.SPS)
}
if len(f.PPS) > 0 {
vt.WriteSliceBytes(f.PPS)
}
case *format.H265:
vt := p.VideoTrack
if vt == nil {
vt = p.CreateVideoTrack(codec.CodecID_H265, byte(f.PayloadType()))
}
p.Tracks[track] = vt
if len(f.VPS) > 0 {
vt.WriteSliceBytes(f.VPS)
}
if len(f.SPS) > 0 {
vt.WriteSliceBytes(f.SPS)
}
if len(f.PPS) > 0 {
vt.WriteSliceBytes(f.PPS)
}
case *format.AV1:
vt := p.VideoTrack
if vt == nil {
vt = p.CreateVideoTrack(codec.CodecID_AV1, byte(f.PayloadType()))
}
p.Tracks[track] = vt
case *format.MPEG4Audio:
at := p.AudioTrack
if at == nil {
conf := f.Config
if f.LATM && f.StreamMuxConfig != nil && len(f.StreamMuxConfig.Programs) > 0 && len(f.StreamMuxConfig.Programs[0].Layers) > 0 {
conf = f.StreamMuxConfig.Programs[0].Layers[0].AudioSpecificConfig
}
at := p.CreateAudioTrack(codec.CodecID_AAC, byte(f.PayloadType()), uint32(conf.SampleRate)).(*AAC)
at.AACFormat = f
at.AACDecoder.LATM = f.LATM
at.AACDecoder.IndexDeltaLength = f.IndexDeltaLength
at.AACDecoder.IndexLength = f.IndexLength
at.AACDecoder.SizeLength = f.SizeLength
if conf.Type == mpeg4audio.ObjectTypeAACLC {
at.Mode = 1
}
at.Channels = uint8(conf.ChannelCount)
asc, _ := conf.Marshal()
// 复用AVCC写入逻辑解析出AAC的配置信息
at.WriteSequenceHead(append([]byte{0xAF, 0x00}, asc...))
}
p.Tracks[track] = p.AudioTrack
case *format.G711:
at := p.AudioTrack
if at == nil {
at = p.CreateAudioTrack(util.Conditoinal(f.MULaw, codec.CodecID_PCMU, codec.CodecID_PCMA), byte(f.PayloadType()), uint32(f.ClockRate()))
}
p.Tracks[track] = at
case *format.Opus:
at := p.AudioTrack
if at == nil {
p.CreateAudioTrack(codec.CodecID_OPUS, byte(f.PayloadType()), uint32(f.ClockRate()))
}
p.Tracks[track] = at
default:
rtpMap := strings.ToLower(forma.RTPMap())
if strings.Contains(rtpMap, "pcm") {
isMulaw := false
if strings.Contains(rtpMap, "pcmu") {
isMulaw = true
}
at := p.AudioTrack
if at == nil {
at = p.CreateAudioTrack(util.Conditoinal(isMulaw, codec.CodecID_PCMU, codec.CodecID_PCMA), byte(f.PayloadType()), uint32(f.ClockRate()))
}
p.Tracks[track] = at
} else {
p.Warn("unknown format", zap.Any("format", f.FMTP()))
}
}
}
}
if p.VideoTrack == nil {
p.Config.PubVideo = false
p.Info("no video track")
}
if p.AudioTrack == nil {
p.Config.PubAudio = false
p.Info("no audio track")
}
return nil
}
func (p *RTSPPublisher) OnPacket(m *description.Media, f format.Format, pack *rtp.Packet) {
if t, ok := p.Tracks[m]; ok {
t.WriteRTPPack(pack)
}
}

View File

@@ -1,100 +0,0 @@
package rtsp
import (
"fmt"
"log"
"regexp"
"strconv"
"strings"
)
const (
RTSP_VERSION = "RTSP/1.0"
)
const (
// Client to server for presentation and stream objects; recommended
DESCRIBE = "DESCRIBE"
// Bidirectional for client and stream objects; optional
ANNOUNCE = "ANNOUNCE"
// Bidirectional for client and stream objects; optional
GET_PARAMETER = "GET_PARAMETER"
// Bidirectional for client and stream objects; required for Client to server, optional for server to client
OPTIONS = "OPTIONS"
// Client to server for presentation and stream objects; recommended
PAUSE = "PAUSE"
// Client to server for presentation and stream objects; required
PLAY = "PLAY"
// Client to server for presentation and stream objects; optional
RECORD = "RECORD"
// Server to client for presentation and stream objects; optional
REDIRECT = "REDIRECT"
// Client to server for stream objects; required
SETUP = "SETUP"
// Bidirectional for presentation and stream objects; optional
SET_PARAMETER = "SET_PARAMETER"
// Client to server for presentation and stream objects; required
TEARDOWN = "TEARDOWN"
DATA = "DATA"
)
type Request struct {
Method string
URL string
Version string
Header map[string]string
Content string
Body string
}
func NewRequest(content string) *Request {
lines := strings.Split(strings.TrimSpace(content), "\r\n")
if len(lines) == 0 {
return nil
}
items := regexp.MustCompile("\\s+").Split(strings.TrimSpace(lines[0]), -1)
if len(items) < 3 {
return nil
}
if !strings.HasPrefix(items[2], "RTSP") {
log.Printf("invalid rtsp request, line[0] %s", lines[0])
return nil
}
header := make(map[string]string)
for i := 1; i < len(lines); i++ {
line := strings.TrimSpace(lines[i])
headerItems := regexp.MustCompile(":\\s+").Split(line, 2)
if len(headerItems) < 2 {
continue
}
header[headerItems[0]] = headerItems[1]
}
return &Request{
Method: items[0],
URL: items[1],
Version: items[2],
Header: header,
Content: content,
Body: "",
}
}
func (r *Request) String() string {
str := fmt.Sprintf("%s %s %s\r\n", r.Method, r.URL, r.Version)
for key, value := range r.Header {
str += fmt.Sprintf("%s: %s\r\n", key, value)
}
str += "\r\n"
str += r.Body
return str
}
func (r *Request) GetContentLength() int {
v, err := strconv.ParseInt(r.Header["Content-Length"], 10, 64)
if err != nil {
return 0
} else {
return int(v)
}
}

View File

@@ -1,51 +0,0 @@
package rtsp
import (
"fmt"
"strconv"
)
type Response struct {
Version string
StatusCode int
Status string
Header map[string]interface{}
Body string
}
func NewResponse(statusCode int, status, cSeq, sid, body string) *Response {
res := &Response{
Version: RTSP_VERSION,
StatusCode: statusCode,
Status: status,
Header: map[string]interface{}{"CSeq": cSeq, "Session": sid},
Body: body,
}
len := len(body)
if len > 0 {
res.Header["Content-Length"] = strconv.Itoa(len)
} else {
delete(res.Header, "Content-Length")
}
return res
}
func (r *Response) String() string {
str := fmt.Sprintf("%s %d %s\r\n", r.Version, r.StatusCode, r.Status)
for key, value := range r.Header {
str += fmt.Sprintf("%s: %s\r\n", key, value)
}
str += "\r\n"
str += r.Body
return str
}
func (r *Response) SetBody(body string) {
len := len(body)
r.Body = body
if len > 0 {
r.Header["Content-Length"] = strconv.Itoa(len)
} else {
delete(r.Header, "Content-Length")
}
}

View File

@@ -1,68 +0,0 @@
package rtsp
import (
"encoding/binary"
)
const (
RTP_FIXED_HEADER_LENGTH = 12
)
type RTPInfo struct {
Version int
Padding bool
Extension bool
CSRCCnt int
Marker bool
PayloadType int
SequenceNumber int
Timestamp int
SSRC int
Payload []byte
PayloadOffset int
}
func ParseRTP(rtpBytes []byte) *RTPInfo {
if len(rtpBytes) < RTP_FIXED_HEADER_LENGTH {
return nil
}
firstByte := rtpBytes[0]
secondByte := rtpBytes[1]
info := &RTPInfo{
Version: int(firstByte >> 6),
Padding: (firstByte>>5)&1 == 1,
Extension: (firstByte>>4)&1 == 1,
CSRCCnt: int(firstByte & 0x0f),
Marker: secondByte>>7 == 1,
PayloadType: int(secondByte & 0x7f),
SequenceNumber: int(binary.BigEndian.Uint16(rtpBytes[2:])),
Timestamp: int(binary.BigEndian.Uint32(rtpBytes[4:])),
SSRC: int(binary.BigEndian.Uint32(rtpBytes[8:])),
}
offset := RTP_FIXED_HEADER_LENGTH
end := len(rtpBytes)
if end-offset >= 4*info.CSRCCnt {
offset += 4 * info.CSRCCnt
}
if info.Extension && end-offset >= 4 {
extLen := 4 * int(binary.BigEndian.Uint16(rtpBytes[offset+2:]))
offset += 4
if end-offset >= extLen {
offset += extLen
}
}
if info.Padding && end-offset > 0 {
paddingLen := int(rtpBytes[end-1])
if end-offset >= paddingLen {
end -= paddingLen
}
}
info.Payload = rtpBytes[offset:end]
info.PayloadOffset = offset
if end-offset < 1 {
return nil
}
return info
}

View File

@@ -1,105 +0,0 @@
package rtsp
import (
"encoding/base64"
"encoding/hex"
"strconv"
"strings"
)
type SDPInfo struct {
AVType string
Codec string
TimeScale int
Control string
Rtpmap int
Config []byte
SpropParameterSets [][]byte
PayloadType int
SizeLength int
IndexLength int
}
func ParseSDP(sdpRaw string) map[string]*SDPInfo {
sdpMap := make(map[string]*SDPInfo)
var info *SDPInfo
for _, line := range strings.Split(sdpRaw, "\n") {
line = strings.TrimSpace(line)
typeval := strings.SplitN(line, "=", 2)
if len(typeval) == 2 {
fields := strings.SplitN(typeval[1], " ", 2)
switch typeval[0] {
case "m":
if len(fields) > 0 {
switch fields[0] {
case "audio", "video":
sdpMap[fields[0]] = &SDPInfo{AVType: fields[0]}
info = sdpMap[fields[0]]
mfields := strings.Split(fields[1], " ")
if len(mfields) >= 3 {
info.PayloadType, _ = strconv.Atoi(mfields[2])
}
}
}
case "a":
if info != nil {
for _, field := range fields {
keyval := strings.SplitN(field, ":", 2)
if len(keyval) >= 2 {
key := keyval[0]
val := keyval[1]
switch key {
case "control":
info.Control = val
case "rtpmap":
info.Rtpmap, _ = strconv.Atoi(val)
}
}
keyval = strings.Split(field, "/")
if len(keyval) >= 2 {
key := keyval[0]
switch key {
case "MPEG4-GENERIC":
info.Codec = "aac"
case "H264":
info.Codec = "h264"
case "H265":
info.Codec = "h265"
}
if i, err := strconv.Atoi(keyval[1]); err == nil {
info.TimeScale = i
}
}
keyval = strings.Split(field, ";")
if len(keyval) > 1 {
for _, field := range keyval {
keyval := strings.SplitN(field, "=", 2)
if len(keyval) == 2 {
key := strings.TrimSpace(keyval[0])
val := keyval[1]
switch key {
case "config":
info.Config, _ = hex.DecodeString(val)
case "sizelength":
info.SizeLength, _ = strconv.Atoi(val)
case "indexlength":
info.IndexLength, _ = strconv.Atoi(val)
case "sprop-parameter-sets":
fields := strings.Split(val, ",")
for _, field := range fields {
val, _ := base64.StdEncoding.DecodeString(field)
info.SpropParameterSets = append(info.SpropParameterSets, val)
}
}
}
}
}
}
}
}
}
}
return sdpMap
}

122
server.go Normal file
View File

@@ -0,0 +1,122 @@
package rtsp
import (
"github.com/bluenviron/gortsplib/v4"
"github.com/bluenviron/gortsplib/v4/pkg/base"
"github.com/bluenviron/gortsplib/v4/pkg/description"
"go.uber.org/zap"
"m7s.live/engine/v4/common"
)
type RTSPIO struct {
server *gortsplib.Server
session *description.Session
tracks []*description.Media
stream *gortsplib.ServerStream
audioTrack *description.Media
videoTrack *description.Media
}
func (conf *RTSPConfig) OnConnOpen(ctx *gortsplib.ServerHandlerOnConnOpenCtx) {
RTSPPlugin.Debug("conn opened")
}
func (conf *RTSPConfig) OnConnClose(ctx *gortsplib.ServerHandlerOnConnCloseCtx) {
RTSPPlugin.Debug("conn closed")
if p, ok := conf.LoadAndDelete(ctx.Conn); ok {
p.(common.IIO).Stop(zap.String("conn", "closed"))
}
}
func (conf *RTSPConfig) OnSessionOpen(ctx *gortsplib.ServerHandlerOnSessionOpenCtx) {
RTSPPlugin.Debug("session opened")
}
func (conf *RTSPConfig) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionCloseCtx) {
RTSPPlugin.Debug("session closed")
conf.Delete(ctx.Session)
}
// called after receiving a DESCRIBE request.
func (conf *RTSPConfig) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*base.Response, *gortsplib.ServerStream, error) {
RTSPPlugin.Debug("describe request", zap.String("sdp", string(ctx.Request.Body)))
var suber RTSPSubscriber
suber.server = conf.server
suber.RemoteAddr = ctx.Conn.NetConn().RemoteAddr().String()
suber.SetIO(ctx.Conn.NetConn())
streamPath := ctx.Path
if ctx.Query != "" {
streamPath = streamPath + "?" + ctx.Query
}
if err := RTSPPlugin.Subscribe(streamPath, &suber); err == nil {
RTSPPlugin.Debug("describe replay ok")
conf.Store(ctx.Conn, &suber)
return &base.Response{
StatusCode: base.StatusOK,
}, suber.stream, nil
} else {
return &base.Response{
StatusCode: base.StatusNotFound,
}, suber.stream, nil
}
}
func (conf *RTSPConfig) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
var resp base.Response
resp.StatusCode = base.StatusOK
if p, ok := conf.Load(ctx.Conn); ok {
switch v := p.(type) {
case *RTSPSubscriber:
return &resp, v.stream, nil
case *RTSPPublisher:
return &resp, v.stream, nil
}
}
resp.StatusCode = base.StatusNotFound
return &resp, nil, nil
}
func (conf *RTSPConfig) OnPlay(ctx *gortsplib.ServerHandlerOnPlayCtx) (*base.Response, error) {
var resp base.Response
resp.StatusCode = base.StatusNotFound
if p, ok := conf.Load(ctx.Conn); ok {
switch v := p.(type) {
case *RTSPSubscriber:
resp.StatusCode = base.StatusOK
go func() {
v.PlayRTP()
ctx.Session.Close()
}()
}
}
return &resp, nil
}
func (conf *RTSPConfig) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.Response, error) {
if p, ok := conf.Load(ctx.Session); ok {
ctx.Session.OnPacketRTPAny(p.(*RTSPPublisher).OnPacket)
}
return &base.Response{
StatusCode: base.StatusOK,
}, nil
}
func (conf *RTSPConfig) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (*base.Response, error) {
RTSPPlugin.Debug("annouce request", zap.String("sdp", string(ctx.Request.Body)))
p := &RTSPPublisher{}
p.SetIO(ctx.Conn.NetConn())
if err := RTSPPlugin.Publish(ctx.Path, p); err == nil {
p.session = ctx.Description
p.stream = gortsplib.NewServerStream(conf.server, ctx.Description)
if err = p.SetTracks(); err != nil {
return nil, err
}
conf.Store(ctx.Conn, p)
conf.Store(ctx.Session, p)
} else {
return &base.Response{
StatusCode: base.StatusBadRequest,
}, nil
}
return &base.Response{
StatusCode: base.StatusOK,
}, nil
}

View File

@@ -1,638 +0,0 @@
package rtsp
import (
"bytes"
"crypto/md5"
"encoding/binary"
"fmt"
"io"
"net/url"
"regexp"
"strconv"
"strings"
"time"
. "github.com/Monibuca/engine/v2"
"github.com/teris-io/shortid"
)
type RTPPack struct {
Type RTPType
Buffer []byte
}
type SessionType int
const (
SESSION_TYPE_PUSHER SessionType = iota
SESSEION_TYPE_PLAYER
)
func (st SessionType) String() string {
switch st {
case SESSION_TYPE_PUSHER:
return "pusher"
case SESSEION_TYPE_PLAYER:
return "player"
}
return "unknow"
}
type RTPType int
const (
RTP_TYPE_AUDIO RTPType = iota
RTP_TYPE_VIDEO
RTP_TYPE_AUDIOCONTROL
RTP_TYPE_VIDEOCONTROL
)
func (rt RTPType) String() string {
switch rt {
case RTP_TYPE_AUDIO:
return "audio"
case RTP_TYPE_VIDEO:
return "video"
case RTP_TYPE_AUDIOCONTROL:
return "audio control"
case RTP_TYPE_VIDEOCONTROL:
return "video control"
}
return "unknow"
}
type TransType int
const (
TRANS_TYPE_TCP TransType = iota
TRANS_TYPE_UDP
)
func (tt TransType) String() string {
switch tt {
case TRANS_TYPE_TCP:
return "TCP"
case TRANS_TYPE_UDP:
return "UDP"
}
return "unknow"
}
const UDP_BUF_SIZE = 1048576
func (session *RTSP) SessionString() string {
return fmt.Sprintf("session[%v][%v][%s][%s][%s]", session.Type, session.TransType, session.StreamPath, session.ID, session.Conn.RemoteAddr().String())
}
func (session *RTSP) Stop() {
if session.Conn != nil {
session.connRW.Flush()
session.Conn.Close()
session.Conn = nil
}
if session.UDPClient != nil {
session.UDPClient.Stop()
session.UDPClient = nil
}
if session.UDPServer != nil {
session.UDPServer.Stop()
session.UDPServer = nil
}
if session.Running() {
collection.Delete(session.StreamPath)
session.Cancel()
}
}
// AcceptPush 接受推流
func (session *RTSP) AcceptPush() {
defer session.Stop()
buf2 := make([]byte, 2)
timer := time.Unix(0, 0)
for {
buf1, err := session.connRW.ReadByte()
if err != nil {
Println(err)
return
}
if buf1 == 0x24 { //rtp data
if buf1, err = session.connRW.ReadByte(); err != nil {
Println(err)
return
}
if _, err := io.ReadFull(session.connRW, buf2); err != nil {
Println(err)
return
}
channel := int(buf1)
rtpLen := int(binary.BigEndian.Uint16(buf2))
rtpBytes := make([]byte, rtpLen)
if _, err := io.ReadFull(session.connRW, rtpBytes); err != nil {
Println(err)
return
}
var pack *RTPPack
switch channel {
case session.aRTPChannel:
pack = &RTPPack{
Type: RTP_TYPE_AUDIO,
Buffer: rtpBytes,
}
elapsed := time.Now().Sub(timer)
if elapsed >= 30*time.Second {
Println("Recv an audio RTP package")
timer = time.Now()
}
case session.aRTPControlChannel:
pack = &RTPPack{
Type: RTP_TYPE_AUDIOCONTROL,
Buffer: rtpBytes,
}
case session.vRTPChannel:
pack = &RTPPack{
Type: RTP_TYPE_VIDEO,
Buffer: rtpBytes,
}
elapsed := time.Now().Sub(timer)
if elapsed >= 30*time.Second {
Println("Recv an video RTP package")
timer = time.Now()
}
case session.vRTPControlChannel:
pack = &RTPPack{
Type: RTP_TYPE_VIDEOCONTROL,
Buffer: rtpBytes,
}
default:
Printf("unknow rtp pack type, %v", pack.Type)
continue
}
if pack == nil {
Printf("session tcp got nil rtp pack")
continue
}
session.InBytes += rtpLen + 4
session.handleRTP(pack)
} else { // rtsp cmd
reqBuf := bytes.NewBuffer(nil)
reqBuf.WriteByte(buf1)
for {
if line, isPrefix, err := session.connRW.ReadLine(); err != nil {
Println(err)
return
} else {
reqBuf.Write(line)
if !isPrefix {
reqBuf.WriteString("\r\n")
}
if len(line) == 0 {
req := NewRequest(reqBuf.String())
if req == nil {
break
}
session.InBytes += reqBuf.Len()
contentLen := req.GetContentLength()
session.InBytes += contentLen
if contentLen > 0 {
bodyBuf := make([]byte, contentLen)
if n, err := io.ReadFull(session.connRW, bodyBuf); err != nil {
Println(err)
return
} else if n != contentLen {
Printf("read rtsp request body failed, expect size[%d], got size[%d]", contentLen, n)
return
}
req.Body = string(bodyBuf)
}
session.handleRequest(req)
break
}
}
}
}
}
}
func (session *RTSP) CheckAuth(authLine string, method string) error {
realmRex := regexp.MustCompile(`realm="(.*?)"`)
nonceRex := regexp.MustCompile(`nonce="(.*?)"`)
usernameRex := regexp.MustCompile(`username="(.*?)"`)
responseRex := regexp.MustCompile(`response="(.*?)"`)
uriRex := regexp.MustCompile(`uri="(.*?)"`)
realm := ""
nonce := ""
username := ""
response := ""
uri := ""
result1 := realmRex.FindStringSubmatch(authLine)
if len(result1) == 2 {
realm = result1[1]
} else {
return fmt.Errorf("CheckAuth error : no realm found")
}
result1 = nonceRex.FindStringSubmatch(authLine)
if len(result1) == 2 {
nonce = result1[1]
} else {
return fmt.Errorf("CheckAuth error : no nonce found")
}
if session.nonce != nonce {
return fmt.Errorf("CheckAuth error : sessionNonce not same as nonce")
}
result1 = usernameRex.FindStringSubmatch(authLine)
if len(result1) == 2 {
username = result1[1]
} else {
return fmt.Errorf("CheckAuth error : username not found")
}
result1 = responseRex.FindStringSubmatch(authLine)
if len(result1) == 2 {
response = result1[1]
} else {
return fmt.Errorf("CheckAuth error : response not found")
}
result1 = uriRex.FindStringSubmatch(authLine)
if len(result1) == 2 {
uri = result1[1]
} else {
return fmt.Errorf("CheckAuth error : uri not found")
}
// var user models.User
// err := db.SQLite.Where("Username = ?", username).First(&user).Error
// if err != nil {
// return fmt.Errorf("CheckAuth error : user not exists")
// }
md5UserRealmPwd := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", username, realm, session.Auth(username)))))
md5MethodURL := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s", method, uri))))
myResponse := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", md5UserRealmPwd, nonce, md5MethodURL))))
if myResponse != response {
return fmt.Errorf("CheckAuth error : response not equal")
}
return nil
}
func (session *RTSP) handleRequest(req *Request) {
//if session.Timeout > 0 {
// session.Conn.SetDeadline(time.Now().Add(time.Duration(session.Timeout) * time.Second))
//}
Printf("<<<\n%s", req)
res := NewResponse(200, "OK", req.Header["CSeq"], session.ID, "")
defer func() {
if p := recover(); p != nil {
Printf("handleRequest err ocurs:%v", p)
res.StatusCode = 500
res.Status = fmt.Sprintf("Inner Server Error, %v", p)
}
Printf(">>>\n%s", res)
outBytes := []byte(res.String())
session.connWLock.Lock()
session.connRW.Write(outBytes)
session.connRW.Flush()
session.connWLock.Unlock()
session.OutBytes += len(outBytes)
switch req.Method {
case "PLAY", "RECORD":
switch session.Type {
case SESSEION_TYPE_PLAYER:
// if session.Pusher.HasPlayer(session.Player) {
// session.Player.Pause(false)
// } else {
// session.Pusher.AddPlayer(session.Player)
// }
}
case "TEARDOWN":
{
session.Stop()
return
}
}
if res.StatusCode != 200 && res.StatusCode != 401 {
Printf("Response request error[%d]. stop session.", res.StatusCode)
session.Stop()
}
}()
if req.Method != "OPTIONS" {
if session.Auth != nil {
authLine := req.Header["Authorization"]
authFailed := true
if authLine != "" {
err := session.CheckAuth(authLine, req.Method)
if err == nil {
authFailed = false
} else {
Printf("%v", err)
}
}
if authFailed {
res.StatusCode = 401
res.Status = "Unauthorized"
nonce := fmt.Sprintf("%x", md5.Sum([]byte(shortid.MustGenerate())))
session.nonce = nonce
res.Header["WWW-Authenticate"] = fmt.Sprintf(`Digest realm="EasyDarwin", nonce="%s", algorithm="MD5"`, nonce)
return
}
}
}
switch req.Method {
case "OPTIONS":
res.Header["Public"] = "DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD"
case "ANNOUNCE":
session.Type = SESSION_TYPE_PUSHER
session.URL = req.URL
url, err := url.Parse(req.URL)
if err != nil {
res.StatusCode = 500
res.Status = "Invalid URL"
return
}
streamPath := strings.TrimPrefix(url.Path,"/")
session.SDPRaw = req.Body
session.SDPMap = ParseSDP(req.Body)
sdp, ok := session.SDPMap["audio"]
if ok {
session.AControl = sdp.Control
session.ACodec = sdp.Codec
session.AudioSpecificConfig = sdp.Config
Printf("audio codec[%s]\n", session.ACodec)
}
if sdp, ok = session.SDPMap["video"];ok {
session.VControl = sdp.Control
session.VCodec = sdp.Codec
session.SPS = sdp.SpropParameterSets[0]
session.PPS = sdp.SpropParameterSets[1]
Printf("video codec[%s]\n", session.VCodec)
}
if session.Publisher.Publish(streamPath) {
session.Stream.Type = "RTSP"
session.RTSPInfo.StreamInfo = &session.Stream.StreamInfo
collection.Store(streamPath, session)
}
case "DESCRIBE":
session.Type = SESSEION_TYPE_PLAYER
session.URL = req.URL
url, err := url.Parse(req.URL)
if err != nil {
res.StatusCode = 500
res.Status = "Invalid URL"
return
}
streamPath := url.Path
stream := FindStream(streamPath)
if stream == nil {
return
}
//
//res.SetBody(session.SDPRaw)
case "SETUP":
ts := req.Header["Transport"]
// control字段可能是`stream=1`字样也可能是rtsp://...字样。即control可能是url的path也可能是整个url
// 例1
// a=control:streamid=1
// 例2
// a=control:rtsp://192.168.1.64/trackID=1
// 例3
// a=control:?ctype=video
setupUrl, err := url.Parse(req.URL)
if err != nil {
res.StatusCode = 500
res.Status = "Invalid URL"
return
}
if setupUrl.Port() == "" {
setupUrl.Host = fmt.Sprintf("%s:554", setupUrl.Host)
}
setupPath := setupUrl.String()
// error status. SETUP without ANNOUNCE or DESCRIBE.
//if session.Pusher == nil {
// res.StatusCode = 500
// res.Status = "Error Status"
// return
//}
vPath := ""
if strings.Index(strings.ToLower(session.VControl), "rtsp://") == 0 {
vControlUrl, err := url.Parse(session.VControl)
if err != nil {
res.StatusCode = 500
res.Status = "Invalid VControl"
return
}
if vControlUrl.Port() == "" {
vControlUrl.Host = fmt.Sprintf("%s:554", vControlUrl.Host)
}
vPath = vControlUrl.String()
} else {
vPath = session.VControl
}
aPath := ""
if strings.Index(strings.ToLower(session.AControl), "rtsp://") == 0 {
aControlUrl, err := url.Parse(session.AControl)
if err != nil {
res.StatusCode = 500
res.Status = "Invalid AControl"
return
}
if aControlUrl.Port() == "" {
aControlUrl.Host = fmt.Sprintf("%s:554", aControlUrl.Host)
}
aPath = aControlUrl.String()
} else {
aPath = session.AControl
}
mtcp := regexp.MustCompile("interleaved=(\\d+)(-(\\d+))?")
mudp := regexp.MustCompile("client_port=(\\d+)(-(\\d+))?")
if tcpMatchs := mtcp.FindStringSubmatch(ts); tcpMatchs != nil {
session.TransType = TRANS_TYPE_TCP
if setupPath == aPath || aPath != "" && strings.LastIndex(setupPath, aPath) == len(setupPath)-len(aPath) {
session.aRTPChannel, _ = strconv.Atoi(tcpMatchs[1])
session.aRTPControlChannel, _ = strconv.Atoi(tcpMatchs[3])
} else if setupPath == vPath || vPath != "" && strings.LastIndex(setupPath, vPath) == len(setupPath)-len(vPath) {
session.vRTPChannel, _ = strconv.Atoi(tcpMatchs[1])
session.vRTPControlChannel, _ = strconv.Atoi(tcpMatchs[3])
} else {
res.StatusCode = 500
res.Status = fmt.Sprintf("SETUP [TCP] got UnKown control:%s", setupPath)
Printf("SETUP [TCP] got UnKown control:%s", setupPath)
}
Printf("Parse SETUP req.TRANSPORT:TCP.Session.Type:%d,control:%s, AControl:%s,VControl:%s", session.Type, setupPath, aPath, vPath)
} else if udpMatchs := mudp.FindStringSubmatch(ts); udpMatchs != nil {
session.TransType = TRANS_TYPE_UDP
// no need for tcp timeout.
session.Conn.timeout = 0
if session.Type == SESSEION_TYPE_PLAYER && session.UDPClient == nil {
session.UDPClient = &UDPClient{}
}
if session.Type == SESSION_TYPE_PUSHER && session.UDPServer == nil {
session.UDPServer = &UDPServer{
Session: session,
}
}
Printf("Parse SETUP req.TRANSPORT:UDP.Session.Type:%d,control:%s, AControl:%s,VControl:%s", session.Type, setupPath, aPath, vPath)
if setupPath == aPath || aPath != "" && strings.LastIndex(setupPath, aPath) == len(setupPath)-len(aPath) {
if session.Type == SESSEION_TYPE_PLAYER {
session.UDPClient.APort, _ = strconv.Atoi(udpMatchs[1])
session.UDPClient.AControlPort, _ = strconv.Atoi(udpMatchs[3])
if err := session.UDPClient.SetupAudio(); err != nil {
res.StatusCode = 500
res.Status = fmt.Sprintf("udp client setup audio error, %v", err)
return
}
}
if session.Type == SESSION_TYPE_PUSHER {
if err := session.UDPServer.SetupAudio(); err != nil {
res.StatusCode = 500
res.Status = fmt.Sprintf("udp server setup audio error, %v", err)
return
}
tss := strings.Split(ts, ";")
idx := -1
for i, val := range tss {
if val == udpMatchs[0] {
idx = i
}
}
tail := append([]string{}, tss[idx+1:]...)
tss = append(tss[:idx+1], fmt.Sprintf("server_port=%d-%d", session.UDPServer.APort, session.UDPServer.AControlPort))
tss = append(tss, tail...)
ts = strings.Join(tss, ";")
}
} else if setupPath == vPath || vPath != "" && strings.LastIndex(setupPath, vPath) == len(setupPath)-len(vPath) {
if session.Type == SESSEION_TYPE_PLAYER {
session.UDPClient.VPort, _ = strconv.Atoi(udpMatchs[1])
session.UDPClient.VControlPort, _ = strconv.Atoi(udpMatchs[3])
if err := session.UDPClient.SetupVideo(); err != nil {
res.StatusCode = 500
res.Status = fmt.Sprintf("udp client setup video error, %v", err)
return
}
}
if session.Type == SESSION_TYPE_PUSHER {
if err := session.UDPServer.SetupVideo(); err != nil {
res.StatusCode = 500
res.Status = fmt.Sprintf("udp server setup video error, %v", err)
return
}
tss := strings.Split(ts, ";")
idx := -1
for i, val := range tss {
if val == udpMatchs[0] {
idx = i
}
}
tail := append([]string{}, tss[idx+1:]...)
tss = append(tss[:idx+1], fmt.Sprintf("server_port=%d-%d", session.UDPServer.VPort, session.UDPServer.VControlPort))
tss = append(tss, tail...)
ts = strings.Join(tss, ";")
}
} else {
Printf("SETUP [UDP] got UnKown control:%s", setupPath)
}
}
res.Header["Transport"] = ts
case "PLAY":
// error status. PLAY without ANNOUNCE or DESCRIBE.
// if session.Pusher == nil {
// res.StatusCode = 500
// res.Status = "Error Status"
// return
// }
res.Header["Range"] = req.Header["Range"]
case "RECORD":
// error status. RECORD without ANNOUNCE or DESCRIBE.
// if session.Pusher == nil {
// res.StatusCode = 500
// res.Status = "Error Status"
// return
// }
case "PAUSE":
// if session.Player == nil {
// res.StatusCode = 500
// res.Status = "Error Status"
// return
// }
// session.Player.Pause(true)
}
}
func (session *RTSP) SendRTP(pack *RTPPack) (err error) {
if pack == nil {
err = fmt.Errorf("player send rtp got nil pack")
return
}
if session.TransType == TRANS_TYPE_UDP {
if session.UDPClient == nil {
err = fmt.Errorf("player use udp transport but udp client not found")
return
}
err = session.UDPClient.SendRTP(pack)
session.OutBytes += len(pack.Buffer)
return
}
switch pack.Type {
case RTP_TYPE_AUDIO:
bufChannel := make([]byte, 2)
bufChannel[0] = 0x24
bufChannel[1] = byte(session.aRTPChannel)
session.connWLock.Lock()
session.connRW.Write(bufChannel)
bufLen := make([]byte, 2)
binary.BigEndian.PutUint16(bufLen, uint16(len(pack.Buffer)))
session.connRW.Write(bufLen)
session.connRW.Write(pack.Buffer)
session.connRW.Flush()
session.connWLock.Unlock()
session.OutBytes += len(pack.Buffer) + 4
case RTP_TYPE_AUDIOCONTROL:
bufChannel := make([]byte, 2)
bufChannel[0] = 0x24
bufChannel[1] = byte(session.aRTPControlChannel)
session.connWLock.Lock()
session.connRW.Write(bufChannel)
bufLen := make([]byte, 2)
binary.BigEndian.PutUint16(bufLen, uint16(len(pack.Buffer)))
session.connRW.Write(bufLen)
session.connRW.Write(pack.Buffer)
session.connRW.Flush()
session.connWLock.Unlock()
session.OutBytes += len(pack.Buffer) + 4
case RTP_TYPE_VIDEO:
bufChannel := make([]byte, 2)
bufChannel[0] = 0x24
bufChannel[1] = byte(session.vRTPChannel)
session.connWLock.Lock()
session.connRW.Write(bufChannel)
bufLen := make([]byte, 2)
binary.BigEndian.PutUint16(bufLen, uint16(len(pack.Buffer)))
session.connRW.Write(bufLen)
session.connRW.Write(pack.Buffer)
session.connRW.Flush()
session.connWLock.Unlock()
session.OutBytes += len(pack.Buffer) + 4
case RTP_TYPE_VIDEOCONTROL:
bufChannel := make([]byte, 2)
bufChannel[0] = 0x24
bufChannel[1] = byte(session.vRTPControlChannel)
session.connWLock.Lock()
session.connRW.Write(bufChannel)
bufLen := make([]byte, 2)
binary.BigEndian.PutUint16(bufLen, uint16(len(pack.Buffer)))
session.connRW.Write(bufLen)
session.connRW.Write(pack.Buffer)
session.connRW.Flush()
session.connWLock.Unlock()
session.OutBytes += len(pack.Buffer) + 4
default:
err = fmt.Errorf("session tcp send rtp got unkown pack type[%v]", pack.Type)
}
return
}

134
subscriber.go Normal file
View File

@@ -0,0 +1,134 @@
package rtsp
import (
"fmt"
"github.com/bluenviron/gortsplib/v4"
"github.com/bluenviron/gortsplib/v4/pkg/description"
"github.com/bluenviron/gortsplib/v4/pkg/format"
"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
. "m7s.live/engine/v4"
"m7s.live/engine/v4/codec"
"m7s.live/engine/v4/track"
)
type RTSPSubscriber struct {
Subscriber
RTSPIO
}
func (s *RTSPSubscriber) OnEvent(event any) {
switch v := event.(type) {
case *track.Video:
if s.Video != nil {
return
}
switch v.CodecID {
case codec.CodecID_H264:
s.videoTrack = &description.Media{
Type: description.MediaTypeVideo,
Formats: []format.Format{&format.H264{
PacketizationMode: 1,
PayloadTyp: v.PayloadType,
SPS: v.ParamaterSets[0],
PPS: v.ParamaterSets[1],
}},
}
case codec.CodecID_H265:
s.videoTrack = &description.Media{
Type: description.MediaTypeVideo,
Formats: []format.Format{&format.H265{
PayloadTyp: v.PayloadType,
VPS: v.ParamaterSets[0],
SPS: v.ParamaterSets[1],
PPS: v.ParamaterSets[2],
}},
}
case codec.CodecID_AV1:
var idx, profile, tail int
idx = int(v.ParamaterSets[1][0])
profile = int(v.ParamaterSets[1][1])
tail = int(v.ParamaterSets[1][2])
s.videoTrack = &description.Media{
Type: description.MediaTypeVideo,
Formats: []format.Format{&format.AV1{
PayloadTyp: v.PayloadType,
LevelIdx: &idx,
Profile: &profile,
Tier: &tail,
}},
}
}
if s.videoTrack != nil {
s.tracks = append(s.tracks, s.videoTrack)
s.AddTrack(v)
}
case *track.Audio:
if s.Audio != nil {
return
}
switch v.CodecID {
case codec.CodecID_AAC:
f := v.AACFormat
if f == nil {
f = &format.MPEG4Audio{
PayloadTyp: v.PayloadType,
Config: &mpeg4audio.Config{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: int(v.SampleRate),
ChannelCount: int(v.Channels),
},
SizeLength: v.AACDecoder.SizeLength,
IndexLength: v.AACDecoder.IndexLength,
IndexDeltaLength: v.AACDecoder.IndexDeltaLength,
}
}
s.audioTrack = &description.Media{
Type: description.MediaTypeAudio,
Formats: []format.Format{f},
}
case codec.CodecID_PCMA:
s.audioTrack = &description.Media{
Type: description.MediaTypeAudio,
Formats: []format.Format{&format.Generic{
PayloadTyp: v.PayloadType,
ClockRat: int(v.SampleRate),
RTPMa: fmt.Sprintf("PCMA/%d", v.SampleRate),
}},
}
case codec.CodecID_PCMU:
s.audioTrack = &description.Media{
Type: description.MediaTypeAudio,
Formats: []format.Format{&format.Generic{
PayloadTyp: v.PayloadType,
ClockRat: int(v.SampleRate),
RTPMa: fmt.Sprintf("PCMU/%d", v.SampleRate),
}},
}
case codec.CodecID_OPUS:
s.audioTrack = &description.Media{
Type: description.MediaTypeAudio,
Formats: []format.Format{&format.Opus{
PayloadTyp: v.PayloadType,
}},
}
}
if s.audioTrack != nil {
s.tracks = append(s.tracks, s.audioTrack)
s.AddTrack(v)
}
case ISubscriber:
s.session = &description.Session{
Medias: s.tracks,
}
if s.server != nil {
s.stream = gortsplib.NewServerStream(s.server, s.session)
}
case VideoRTP:
s.stream.WritePacketRTP(s.videoTrack, v.Packet)
case AudioRTP:
s.stream.WritePacketRTP(s.audioTrack, v.Packet)
default:
s.Subscriber.OnEvent(event)
}
}

View File

@@ -1,160 +0,0 @@
package rtsp
import (
"fmt"
"net"
"strings"
. "github.com/Monibuca/engine/v2"
)
type UDPClient struct {
APort int
AConn *net.UDPConn
AControlPort int
AControlConn *net.UDPConn
VPort int
VConn *net.UDPConn
VControlPort int
VControlConn *net.UDPConn
Stoped bool
}
func (s *UDPClient) Stop() {
if s.Stoped {
return
}
s.Stoped = true
if s.AConn != nil {
s.AConn.Close()
s.AConn = nil
}
if s.AControlConn != nil {
s.AControlConn.Close()
s.AControlConn = nil
}
if s.VConn != nil {
s.VConn.Close()
s.VConn = nil
}
if s.VControlConn != nil {
s.VControlConn.Close()
s.VControlConn = nil
}
}
func (c *UDPClient) SetupAudio() (err error) {
defer func() {
if err != nil {
Println(err)
c.Stop()
}
}()
host := c.AConn.RemoteAddr().String()
host = host[:strings.LastIndex(host, ":")]
addr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", host, c.APort))
if err != nil {
return
}
c.AConn, err = net.DialUDP("udp", nil, addr)
if err != nil {
return
}
networkBuffer := 1048576
if err := c.AConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp client audio conn set read buffer error, %v", err)
}
if err := c.AConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp client audio conn set write buffer error, %v", err)
}
addr, err = net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", host, c.AControlPort))
if err != nil {
return
}
c.AControlConn, err = net.DialUDP("udp", nil, addr)
if err != nil {
return
}
if err := c.AControlConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp client audio control conn set read buffer error, %v", err)
}
if err := c.AControlConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp client audio control conn set write buffer error, %v", err)
}
return
}
func (c *UDPClient) SetupVideo() (err error) {
defer func() {
if err != nil {
Println(err)
c.Stop()
}
}()
host := c.VConn.RemoteAddr().String()
host = host[:strings.LastIndex(host, ":")]
addr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", host, c.VPort))
if err != nil {
return
}
c.VConn, err = net.DialUDP("udp", nil, addr)
if err != nil {
return
}
networkBuffer := 1048576
if err := c.VConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp client video conn set read buffer error, %v", err)
}
if err := c.VConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp client video conn set write buffer error, %v", err)
}
addr, err = net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", host, c.VControlPort))
if err != nil {
return
}
c.VControlConn, err = net.DialUDP("udp", nil, addr)
if err != nil {
return
}
if err := c.VControlConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp client video control conn set read buffer error, %v", err)
}
if err := c.VControlConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp client video control conn set write buffer error, %v", err)
}
return
}
func (c *UDPClient) SendRTP(pack *RTPPack) (err error) {
if pack == nil {
err = fmt.Errorf("udp client send rtp got nil pack")
return
}
var conn *net.UDPConn
switch pack.Type {
case RTP_TYPE_AUDIO:
conn = c.AConn
case RTP_TYPE_AUDIOCONTROL:
conn = c.AControlConn
case RTP_TYPE_VIDEO:
conn = c.VConn
case RTP_TYPE_VIDEOCONTROL:
conn = c.VControlConn
default:
err = fmt.Errorf("udp client send rtp got unkown pack type[%v]", pack.Type)
return
}
if conn == nil {
err = fmt.Errorf("udp client send rtp pack type[%v] failed, conn not found", pack.Type)
return
}
if _, err = conn.Write(pack.Buffer);err != nil {
err = fmt.Errorf("udp client write bytes error, %v", err)
return
}
// Printf("udp client write [%d/%d]", n, pack.Buffer.Len())
return
}

View File

@@ -1,242 +0,0 @@
package rtsp
import (
"fmt"
"net"
"strconv"
"strings"
"sync"
"time"
. "github.com/Monibuca/engine/v2"
)
type UDPServer struct {
Session *RTSP
UDPClient
sync.Mutex
}
func (s *UDPServer) AddInputBytes(bytes int) {
if s.Session != nil {
s.Session.InBytes += bytes
return
}
panic(fmt.Errorf("session and RTSPClient both nil"))
}
func (s *UDPServer) HandleRTP(pack *RTPPack) {
s.Lock()
defer s.Unlock()
if s.Session != nil {
s.Session.handleRTP(pack)
}
}
func (s *UDPServer) Stop() {
if s.Stoped {
return
}
s.Stoped = true
if s.AConn != nil {
s.AConn.Close()
s.AConn = nil
}
if s.AControlConn != nil {
s.AControlConn.Close()
s.AControlConn = nil
}
if s.VConn != nil {
s.VConn.Close()
s.VConn = nil
}
if s.VControlConn != nil {
s.VControlConn.Close()
s.VControlConn = nil
}
}
func (s *UDPServer) SetupAudio() (err error) {
addr, err := net.ResolveUDPAddr("udp", ":0")
if err != nil {
return
}
s.AConn, err = net.ListenUDP("udp", addr)
if err != nil {
return
}
networkBuffer := 1048576
if err := s.AConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp server audio conn set read buffer error, %v", err)
}
if err := s.AConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp server audio conn set write buffer error, %v", err)
}
la := s.AConn.LocalAddr().String()
strPort := la[strings.LastIndex(la, ":")+1:]
s.APort, err = strconv.Atoi(strPort)
if err != nil {
return
}
go func() {
bufUDP := make([]byte, UDP_BUF_SIZE)
Printf("udp server start listen audio port[%d]", s.APort)
defer Printf("udp server stop listen audio port[%d]", s.APort)
timer := time.Unix(0, 0)
for !s.Stoped {
if n, _, err := s.AConn.ReadFromUDP(bufUDP); err == nil {
elapsed := time.Now().Sub(timer)
if elapsed >= 30*time.Second {
Printf("Package recv from AConn.len:%d\n", n)
timer = time.Now()
}
rtpBytes := make([]byte, n)
s.AddInputBytes(n)
copy(rtpBytes, bufUDP)
pack := &RTPPack{
Type: RTP_TYPE_AUDIO,
Buffer: rtpBytes,
}
s.HandleRTP(pack)
} else {
Println("udp server read audio pack error", err)
continue
}
}
}()
addr, err = net.ResolveUDPAddr("udp", ":0")
if err != nil {
return
}
s.AControlConn, err = net.ListenUDP("udp", addr)
if err != nil {
return
}
if err := s.AControlConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp server audio control conn set read buffer error, %v", err)
}
if err := s.AControlConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp server audio control conn set write buffer error, %v", err)
}
la = s.AControlConn.LocalAddr().String()
strPort = la[strings.LastIndex(la, ":")+1:]
s.AControlPort, err = strconv.Atoi(strPort)
if err != nil {
return
}
go func() {
bufUDP := make([]byte, UDP_BUF_SIZE)
Printf("udp server start listen audio control port[%d]", s.AControlPort)
defer Printf("udp server stop listen audio control port[%d]", s.AControlPort)
for !s.Stoped {
if n, _, err := s.AControlConn.ReadFromUDP(bufUDP); err == nil {
//Printf("Package recv from AControlConn.len:%d\n", n)
rtpBytes := make([]byte, n)
s.AddInputBytes(n)
copy(rtpBytes, bufUDP)
pack := &RTPPack{
Type: RTP_TYPE_AUDIOCONTROL,
Buffer: rtpBytes,
}
s.HandleRTP(pack)
} else {
Println("udp server read audio control pack error", err)
continue
}
}
}()
return
}
func (s *UDPServer) SetupVideo() (err error) {
addr, err := net.ResolveUDPAddr("udp", ":0")
if err != nil {
return
}
s.VConn, err = net.ListenUDP("udp", addr)
if err != nil {
return
}
networkBuffer := 1048576
if err := s.VConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp server video conn set read buffer error, %v", err)
}
if err := s.VConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp server video conn set write buffer error, %v", err)
}
la := s.VConn.LocalAddr().String()
strPort := la[strings.LastIndex(la, ":")+1:]
s.VPort, err = strconv.Atoi(strPort)
if err != nil {
return
}
go func() {
bufUDP := make([]byte, UDP_BUF_SIZE)
Printf("udp server start listen video port[%d]", s.VPort)
defer Printf("udp server stop listen video port[%d]", s.VPort)
timer := time.Unix(0, 0)
for !s.Stoped {
if n, _, err := s.VConn.ReadFromUDP(bufUDP); err == nil {
elapsed := time.Now().Sub(timer)
if elapsed >= 30*time.Second {
Printf("Package recv from VConn.len:%d\n", n)
timer = time.Now()
}
rtpBytes := make([]byte, n)
s.AddInputBytes(n)
copy(rtpBytes, bufUDP)
pack := &RTPPack{
Type: RTP_TYPE_VIDEO,
Buffer: rtpBytes,
}
s.HandleRTP(pack)
} else {
Println("udp server read video pack error", err)
continue
}
}
}()
addr, err = net.ResolveUDPAddr("udp", ":0")
if err != nil {
return
}
s.VControlConn, err = net.ListenUDP("udp", addr)
if err != nil {
return
}
if err := s.VControlConn.SetReadBuffer(networkBuffer); err != nil {
Printf("udp server video control conn set read buffer error, %v", err)
}
if err := s.VControlConn.SetWriteBuffer(networkBuffer); err != nil {
Printf("udp server video control conn set write buffer error, %v", err)
}
la = s.VControlConn.LocalAddr().String()
strPort = la[strings.LastIndex(la, ":")+1:]
s.VControlPort, err = strconv.Atoi(strPort)
if err != nil {
return
}
go func() {
bufUDP := make([]byte, UDP_BUF_SIZE)
Printf("udp server start listen video control port[%d]", s.VControlPort)
defer Printf("udp server stop listen video control port[%d]", s.VControlPort)
for !s.Stoped {
if n, _, err := s.VControlConn.ReadFromUDP(bufUDP); err == nil {
//Printf("Package recv from VControlConn.len:%d\n", n)
rtpBytes := make([]byte, n)
s.AddInputBytes(n)
copy(rtpBytes, bufUDP)
pack := &RTPPack{
Type: RTP_TYPE_VIDEOCONTROL,
Buffer: rtpBytes,
}
s.HandleRTP(pack)
} else {
Println("udp server read video control pack error", err)
continue
}
}
}()
return
}

19
ui/dist/demo.html vendored
View File

@@ -1,19 +0,0 @@
<meta charset="utf-8">
<title>plugin-rtsp demo</title>
<script src="https://unpkg.com/vue"></script>
<script src="./plugin-rtsp.umd.js"></script>
<link rel="stylesheet" href="./plugin-rtsp.css">
<div id="app">
<demo></demo>
</div>
<script>
new Vue({
components: {
demo: plugin-rtsp
}
}).$mount('#app')
</script>

View File

@@ -1,415 +0,0 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ "034f":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("85ec");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "85ec":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "f6fd":
/***/ (function(module, exports) {
// document.currentScript polyfill by Adam Miller
// MIT license
(function(document){
var currentScript = "currentScript",
scripts = document.getElementsByTagName('script'); // Live NodeList collection
// If browser needs currentScript polyfill, add get currentScript() to the document object
if (!(currentScript in document)) {
Object.defineProperty(document, currentScript, {
get: function(){
// IE 6-10 supports script readyState
// IE 10+ support stack trace
try { throw new Error(); }
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
// Specifically works with the format of stack traces in IE.
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1];
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag
for(i in scripts){
if(scripts[i].src == res || scripts[i].readyState == "interactive"){
return scripts[i];
}
}
// If no match, return null
return null;
}
}
});
}
})(document);
/***/ }),
/***/ "fb15":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
if (true) {
__webpack_require__("f6fd")
}
var i
if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = i[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"29918b3a-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=template&id=3ee6bce0&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('mu-data-table',{attrs:{"data":_vm.Streams,"columns":_vm.columns},scopedSlots:_vm._u([{key:"default",fn:function(ref){
var item = ref.row;
return [_c('td',[_vm._v(_vm._s(item.StreamInfo.StreamPath))]),_c('td',[_c('StartTime',{attrs:{"value":item.StreamInfo.StartTime}})],1),_c('td',[_c('Progress',{attrs:{"stroke-width":20,"percent":Math.ceil(item.BufferRate),"text-inside":""}})],1),_c('td',[_vm._v(_vm._s(item.SyncCount))]),_c('td',[_c('mu-button',{attrs:{"flat":""},on:{"click":function($event){return _vm.showHeader(item)}}},[_vm._v("头信息")])],1)]}}])}),_c('mu-dialog',{attrs:{"title":"拉流转发","width":"360","open":_vm.openPull},on:{"update:open":function($event){_vm.openPull=$event}}},[_c('mu-text-field',{attrs:{"label":"rtsp url","label-float":"","help-text":"Please enter URL of rtsp..."},model:{value:(_vm.remoteAddr),callback:function ($$v) {_vm.remoteAddr=$$v},expression:"remoteAddr"}}),_c('mu-text-field',{attrs:{"label":"streamPath","label-float":"","help-text":"Please enter streamPath to publish."},model:{value:(_vm.streamPath),callback:function ($$v) {_vm.streamPath=$$v},expression:"streamPath"}}),_c('mu-button',{attrs:{"slot":"actions","flat":"","color":"primary"},on:{"click":_vm.addPull},slot:"actions"},[_vm._v("确定")])],1)],1)}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/App.vue?vue&type=template&id=3ee6bce0&
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
let listES = null;
/* harmony default export */ var Appvue_type_script_lang_js_ = ({
data() {
return {
currentStream: null,
Streams: null,
remoteAddr: "",
streamPath: "",
openPull: false,
columns: [
"StreamPath",
"开始时间",
"缓冲",
"同步数",
"操作"
].map(title => ({ title }))
};
},
methods: {
fetchlist() {
listES = new EventSource(this.apiHost + "/rtsp/list");
listES.onmessage = evt => {
if (!evt.data) return;
this.Streams = JSON.parse(evt.data) || [];
this.Streams.sort((a, b) =>
a.StreamInfo.StreamPath > b.StreamInfo.StreamPath ? 1 : -1
);
};
},
showHeader(item) {
this.$Modal.info({
title: "RTSP Header",
width: "1000px",
scrollable: true,
content: item.Header
});
},
addPull() {
this.openPull = false;
this.ajax
.getJSON(this.apiHost + "/rtsp/pull", {
target: this.remoteAddr,
streamPath: this.streamPath
})
.then(x => {
if (x.code == 0) {
this.$toast.success("已启动拉流");
} else {
this.$toast.error(x.msg);
}
});
}
},
mounted() {
this.fetchlist();
let _this = this;
this.$parent.titleOps = [
{
template: '<m-button @click="onClick">拉流转发</m-button>',
methods: {
onClick() {
_this.openPull = true;
}
}
}
];
},
destroyed() {
listES.close();
}
});
// CONCATENATED MODULE: ./src/App.vue?vue&type=script&lang=js&
/* harmony default export */ var src_Appvue_type_script_lang_js_ = (Appvue_type_script_lang_js_);
// EXTERNAL MODULE: ./src/App.vue?vue&type=style&index=0&lang=css&
var Appvue_type_style_index_0_lang_css_ = __webpack_require__("034f");
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
// CONCATENATED MODULE: ./src/App.vue
/* normalize component */
var component = normalizeComponent(
src_Appvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var App = (component.exports);
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (App);
/***/ })
/******/ })["default"];
//# sourceMappingURL=plugin-rtsp.common.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
.empty{color:#eb5e46;width:100%;min-height:500px;display:flex;justify-content:center;align-items:center}.layout{padding-bottom:30px;display:flex;flex-wrap:wrap}.ts-info{width:300px}.hls-info{width:350px;display:flex;flex-direction:column}

View File

@@ -1,425 +0,0 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["plugin-rtsp"] = factory();
else
root["plugin-rtsp"] = factory();
})((typeof self !== 'undefined' ? self : this), function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ "034f":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("85ec");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "85ec":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "f6fd":
/***/ (function(module, exports) {
// document.currentScript polyfill by Adam Miller
// MIT license
(function(document){
var currentScript = "currentScript",
scripts = document.getElementsByTagName('script'); // Live NodeList collection
// If browser needs currentScript polyfill, add get currentScript() to the document object
if (!(currentScript in document)) {
Object.defineProperty(document, currentScript, {
get: function(){
// IE 6-10 supports script readyState
// IE 10+ support stack trace
try { throw new Error(); }
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
// Specifically works with the format of stack traces in IE.
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1];
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag
for(i in scripts){
if(scripts[i].src == res || scripts[i].readyState == "interactive"){
return scripts[i];
}
}
// If no match, return null
return null;
}
}
});
}
})(document);
/***/ }),
/***/ "fb15":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
if (true) {
__webpack_require__("f6fd")
}
var i
if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = i[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"29918b3a-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=template&id=3ee6bce0&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('mu-data-table',{attrs:{"data":_vm.Streams,"columns":_vm.columns},scopedSlots:_vm._u([{key:"default",fn:function(ref){
var item = ref.row;
return [_c('td',[_vm._v(_vm._s(item.StreamInfo.StreamPath))]),_c('td',[_c('StartTime',{attrs:{"value":item.StreamInfo.StartTime}})],1),_c('td',[_c('Progress',{attrs:{"stroke-width":20,"percent":Math.ceil(item.BufferRate),"text-inside":""}})],1),_c('td',[_vm._v(_vm._s(item.SyncCount))]),_c('td',[_c('mu-button',{attrs:{"flat":""},on:{"click":function($event){return _vm.showHeader(item)}}},[_vm._v("头信息")])],1)]}}])}),_c('mu-dialog',{attrs:{"title":"拉流转发","width":"360","open":_vm.openPull},on:{"update:open":function($event){_vm.openPull=$event}}},[_c('mu-text-field',{attrs:{"label":"rtsp url","label-float":"","help-text":"Please enter URL of rtsp..."},model:{value:(_vm.remoteAddr),callback:function ($$v) {_vm.remoteAddr=$$v},expression:"remoteAddr"}}),_c('mu-text-field',{attrs:{"label":"streamPath","label-float":"","help-text":"Please enter streamPath to publish."},model:{value:(_vm.streamPath),callback:function ($$v) {_vm.streamPath=$$v},expression:"streamPath"}}),_c('mu-button',{attrs:{"slot":"actions","flat":"","color":"primary"},on:{"click":_vm.addPull},slot:"actions"},[_vm._v("确定")])],1)],1)}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/App.vue?vue&type=template&id=3ee6bce0&
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
let listES = null;
/* harmony default export */ var Appvue_type_script_lang_js_ = ({
data() {
return {
currentStream: null,
Streams: null,
remoteAddr: "",
streamPath: "",
openPull: false,
columns: [
"StreamPath",
"开始时间",
"缓冲",
"同步数",
"操作"
].map(title => ({ title }))
};
},
methods: {
fetchlist() {
listES = new EventSource(this.apiHost + "/rtsp/list");
listES.onmessage = evt => {
if (!evt.data) return;
this.Streams = JSON.parse(evt.data) || [];
this.Streams.sort((a, b) =>
a.StreamInfo.StreamPath > b.StreamInfo.StreamPath ? 1 : -1
);
};
},
showHeader(item) {
this.$Modal.info({
title: "RTSP Header",
width: "1000px",
scrollable: true,
content: item.Header
});
},
addPull() {
this.openPull = false;
this.ajax
.getJSON(this.apiHost + "/rtsp/pull", {
target: this.remoteAddr,
streamPath: this.streamPath
})
.then(x => {
if (x.code == 0) {
this.$toast.success("已启动拉流");
} else {
this.$toast.error(x.msg);
}
});
}
},
mounted() {
this.fetchlist();
let _this = this;
this.$parent.titleOps = [
{
template: '<m-button @click="onClick">拉流转发</m-button>',
methods: {
onClick() {
_this.openPull = true;
}
}
}
];
},
destroyed() {
listES.close();
}
});
// CONCATENATED MODULE: ./src/App.vue?vue&type=script&lang=js&
/* harmony default export */ var src_Appvue_type_script_lang_js_ = (Appvue_type_script_lang_js_);
// EXTERNAL MODULE: ./src/App.vue?vue&type=style&index=0&lang=css&
var Appvue_type_style_index_0_lang_css_ = __webpack_require__("034f");
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
// CONCATENATED MODULE: ./src/App.vue
/* normalize component */
var component = normalizeComponent(
src_Appvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var App = (component.exports);
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (App);
/***/ })
/******/ })["default"];
});
//# sourceMappingURL=plugin-rtsp.umd.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +0,0 @@
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["plugin-rtsp"]=e():t["plugin-rtsp"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s="fb15")}({"034f":function(t,e,r){"use strict";var n=r("85ec"),o=r.n(n);o.a},"85ec":function(t,e,r){},f6fd:function(t,e){(function(t){var e="currentScript",r=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(n){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(n.stack)||[!1])[1];for(t in r)if(r[t].src==e||"interactive"==r[t].readyState)return r[t];return null}}})})(document)},fb15:function(t,e,r){"use strict";var n;(r.r(e),"undefined"!==typeof window)&&(r("f6fd"),(n=window.document.currentScript)&&(n=n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(r.p=n[1]));var o=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[r("mu-data-table",{attrs:{data:t.Streams,columns:t.columns},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[r("td",[t._v(t._s(n.StreamInfo.StreamPath))]),r("td",[r("StartTime",{attrs:{value:n.StreamInfo.StartTime}})],1),r("td",[r("Progress",{attrs:{"stroke-width":20,percent:Math.ceil(n.BufferRate),"text-inside":""}})],1),r("td",[t._v(t._s(n.SyncCount))]),r("td",[r("mu-button",{attrs:{flat:""},on:{click:function(e){return t.showHeader(n)}}},[t._v("头信息")])],1)]}}])}),r("mu-dialog",{attrs:{title:"拉流转发",width:"360",open:t.openPull},on:{"update:open":function(e){t.openPull=e}}},[r("mu-text-field",{attrs:{label:"rtsp url","label-float":"","help-text":"Please enter URL of rtsp..."},model:{value:t.remoteAddr,callback:function(e){t.remoteAddr=e},expression:"remoteAddr"}}),r("mu-text-field",{attrs:{label:"streamPath","label-float":"","help-text":"Please enter streamPath to publish."},model:{value:t.streamPath,callback:function(e){t.streamPath=e},expression:"streamPath"}}),r("mu-button",{attrs:{slot:"actions",flat:"",color:"primary"},on:{click:t.addPull},slot:"actions"},[t._v("确定")])],1)],1)},a=[];let s=null;var i={data(){return{currentStream:null,Streams:null,remoteAddr:"",streamPath:"",openPull:!1,columns:["StreamPath","开始时间","缓冲","同步数","操作"].map(t=>({title:t}))}},methods:{fetchlist(){s=new EventSource(this.apiHost+"/rtsp/list"),s.onmessage=t=>{t.data&&(this.Streams=JSON.parse(t.data)||[],this.Streams.sort((t,e)=>t.StreamInfo.StreamPath>e.StreamInfo.StreamPath?1:-1))}},showHeader(t){this.$Modal.info({title:"RTSP Header",width:"1000px",scrollable:!0,content:t.Header})},addPull(){this.openPull=!1,this.ajax.getJSON(this.apiHost+"/rtsp/pull",{target:this.remoteAddr,streamPath:this.streamPath}).then(t=>{0==t.code?this.$toast.success("已启动拉流"):this.$toast.error(t.msg)})}},mounted(){this.fetchlist();let t=this;this.$parent.titleOps=[{template:'<m-button @click="onClick">拉流转发</m-button>',methods:{onClick(){t.openPull=!0}}}]},destroyed(){s.close()}},l=i;r("034f");function u(t,e,r,n,o,a,s,i){var l,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=r,u._compiled=!0),n&&(u.functional=!0),a&&(u._scopeId="data-v-"+a),s?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):o&&(l=i?function(){o.call(this,this.$root.$options.shadowRoot)}:o),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,l):[l]}return{exports:t,options:u}}var c=u(l,o,a,!1,null,null,null),d=c.exports;e["default"]=d}})["default"]}));
//# sourceMappingURL=plugin-rtsp.umd.min.js.map

File diff suppressed because one or more lines are too long

9560
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +0,0 @@
{
"name": "dashboard",
"version": "1.0.0",
"description": "dashboard of rtsp plugin for monibuca",
"main": "index.js",
"scripts": {
"build": "vue-cli-service build --target lib --name plugin-rtsp"
},
"author": "dexter",
"license": "ISC",
"devDependencies": {
"@vue/cli-service": "^4.2.3",
"vue-template-compiler": "^2.6.11"
}
}

View File

@@ -1,125 +0,0 @@
<template>
<div>
<mu-data-table :data="Streams" :columns="columns">
<template #default="{row:item}">
<td>{{item.StreamInfo.StreamPath}}</td>
<td>
<StartTime :value="item.StreamInfo.StartTime"></StartTime>
</td>
<td><Progress :stroke-width="20" :percent="Math.ceil(item.BufferRate)" text-inside /></td>
<td>{{item.SyncCount}}</td>
<td>
<mu-button flat @click="showHeader(item)">头信息</mu-button>
</td>
</template>
</mu-data-table>
<mu-dialog title="拉流转发" width="360" :open.sync="openPull">
<mu-text-field v-model="remoteAddr" label="rtsp url" label-float help-text="Please enter URL of rtsp...">
</mu-text-field>
<mu-text-field v-model="streamPath" label="streamPath" label-float
help-text="Please enter streamPath to publish."></mu-text-field>
<mu-button slot="actions" flat color="primary" @click="addPull">确定</mu-button>
</mu-dialog>
</div>
</template>
<script>
let listES = null;
export default {
data() {
return {
currentStream: null,
Streams: null,
remoteAddr: "",
streamPath: "",
openPull: false,
columns: [
"StreamPath",
"开始时间",
"缓冲",
"同步数",
"操作"
].map(title => ({ title }))
};
},
methods: {
fetchlist() {
listES = new EventSource(this.apiHost + "/rtsp/list");
listES.onmessage = evt => {
if (!evt.data) return;
this.Streams = JSON.parse(evt.data) || [];
this.Streams.sort((a, b) =>
a.StreamInfo.StreamPath > b.StreamInfo.StreamPath ? 1 : -1
);
};
},
showHeader(item) {
this.$Modal.info({
title: "RTSP Header",
width: "1000px",
scrollable: true,
content: item.Header
});
},
addPull() {
this.openPull = false;
this.ajax
.getJSON(this.apiHost + "/rtsp/pull", {
target: this.remoteAddr,
streamPath: this.streamPath
})
.then(x => {
if (x.code == 0) {
this.$toast.success("已启动拉流");
} else {
this.$toast.error(x.msg);
}
});
}
},
mounted() {
this.fetchlist();
let _this = this;
this.$parent.titleOps = [
{
template: '<m-button @click="onClick">拉流转发</m-button>',
methods: {
onClick() {
_this.openPull = true;
}
}
}
];
},
destroyed() {
listES.close();
}
};
</script>
<style>
.empty {
color: #eb5e46;
width: 100%;
min-height: 500px;
display: flex;
justify-content: center;
align-items: center;
}
.layout {
padding-bottom: 30px;
display: flex;
flex-wrap: wrap;
}
.ts-info {
width: 300px;
}
.hls-info {
width: 350px;
display: flex;
flex-direction: column;
}
</style>