mirror of
https://github.com/Monibuca/plugin-rtmp.git
synced 2025-10-05 15:37:11 +08:00
修复接续发布
This commit is contained in:
29
README.md
29
README.md
@@ -40,17 +40,24 @@ ffplay -i rtmp://localhost/live/test
|
|||||||
```yaml
|
```yaml
|
||||||
rtmp:
|
rtmp:
|
||||||
publish:
|
publish:
|
||||||
pubaudio: true
|
pubaudio: true # 是否发布音频流
|
||||||
pubvideo: true
|
pubvideo: true # 是否发布视频流
|
||||||
kickexist: false
|
kickexist: false # 剔出已经存在的发布者,用于顶替原有发布者
|
||||||
publishtimeout: 10
|
publishtimeout: 10s # 发布流默认过期时间,超过该时间发布者没有恢复流将被删除
|
||||||
waitclosetimeout: 0
|
delayclosetimeout: 0 # 自动关闭触发后延迟的时间(期间内如果有新的订阅则取消触发关闭),0为关闭该功能,保持连接。
|
||||||
delayclosetimeout: 0
|
waitclosetimeout: 0 # 发布者断开后等待时间,超过该时间发布者没有恢复流将被删除,0为关闭该功能,由订阅者决定是否删除
|
||||||
|
buffertime: 0 # 缓存时间,用于时光回溯,0为关闭缓存
|
||||||
subscribe:
|
subscribe:
|
||||||
subaudio: true
|
subaudio: true # 是否订阅音频流
|
||||||
subvideo: true
|
subvideo: true # 是否订阅视频流
|
||||||
iframeonly: false
|
subaudioargname: ats # 订阅音频轨道参数名
|
||||||
waittimeout: 10
|
subvideoargname: vts # 订阅视频轨道参数名
|
||||||
|
subdataargname: dts # 订阅数据轨道参数名
|
||||||
|
subaudiotracks: [] # 订阅音频轨道名称列表
|
||||||
|
subvideotracks: [] # 订阅视频轨道名称列表
|
||||||
|
submode: 0 # 订阅模式,0为跳帧追赶模式,1为不追赶(多用于录制),2为时光回溯模式
|
||||||
|
iframeonly: false # 只订阅关键帧
|
||||||
|
waittimeout: 10s # 等待发布者的超时时间,用于订阅尚未发布的流
|
||||||
tcp:
|
tcp:
|
||||||
listenaddr: :1935
|
listenaddr: :1935
|
||||||
listennum: 0
|
listennum: 0
|
||||||
@@ -61,7 +68,7 @@ rtmp:
|
|||||||
push:
|
push:
|
||||||
repush: 0 # 当断开后是否自动重新推流,0代表不进行重新推流,-1代表无限次重新推流
|
repush: 0 # 当断开后是否自动重新推流,0代表不进行重新推流,-1代表无限次重新推流
|
||||||
pushlist: {} # 推流列表,以 streamPath为key,远程地址为value
|
pushlist: {} # 推流列表,以 streamPath为key,远程地址为value
|
||||||
chunksize: 4096
|
chunksize: 65536 # rtmp chunk size
|
||||||
keepalive: false #保持rtmp连接,默认随着stream的close而主动断开
|
keepalive: false #保持rtmp连接,默认随着stream的close而主动断开
|
||||||
```
|
```
|
||||||
:::tip 配置覆盖
|
:::tip 配置覆盖
|
||||||
|
14
media.go
14
media.go
@@ -121,6 +121,20 @@ type RTMPReceiver struct {
|
|||||||
NetStream
|
NetStream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *RTMPReceiver) OnEvent(event any) {
|
||||||
|
r.Publisher.OnEvent(event)
|
||||||
|
switch event.(type) {
|
||||||
|
case IPublisher:
|
||||||
|
r.Publisher.OnEvent(event)
|
||||||
|
if r.AudioTrack != nil {
|
||||||
|
r.AudioTrack.SetStuff(r.bytePool)
|
||||||
|
}
|
||||||
|
if r.VideoTrack != nil {
|
||||||
|
r.VideoTrack.SetStuff(r.bytePool)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (r *RTMPReceiver) Response(tid uint64, code, level string) error {
|
func (r *RTMPReceiver) Response(tid uint64, code, level string) error {
|
||||||
m := new(ResponsePublishMessage)
|
m := new(ResponsePublishMessage)
|
||||||
m.CommandName = Response_OnStatus
|
m.CommandName = Response_OnStatus
|
||||||
|
Reference in New Issue
Block a user