chore: fit engine update

This commit is contained in:
langhuihui
2023-08-13 14:50:26 +08:00
parent b4389cce61
commit d637be6f61
2 changed files with 9 additions and 5 deletions

View File

@@ -31,9 +31,9 @@ func (c *HDLConfig) OnEvent(event any) {
for streamPath, url := range c.PullOnStart { for streamPath, url := range c.PullOnStart {
pull(streamPath, url) pull(streamPath, url)
} }
case *Stream: //按需拉流 case InvitePublish: //按需拉流
if url, ok := c.PullOnSub[v.Path]; ok { if url, ok := c.PullOnSub[v.Target]; ok {
pull(v.Path, url) pull(v.Target, url)
} }
} }
} }
@@ -59,7 +59,7 @@ func (c *HDLConfig) API_Pull(rw http.ResponseWriter, r *http.Request) {
} }
func (*HDLConfig) API_List(rw http.ResponseWriter, r *http.Request) { func (*HDLConfig) API_List(rw http.ResponseWriter, r *http.Request) {
util.ReturnJson(FilterStreams[*HDLPuller], time.Second, rw, r) util.ReturnFetchValue(FilterStreams[*HDLPuller], rw, r)
} }
// 确保HDLConfig实现了PullPlugin接口 // 确保HDLConfig实现了PullPlugin接口

View File

@@ -27,7 +27,11 @@ func NewHDLPuller() *HDLPuller {
pool: make(util.BytesPool, 17), pool: make(util.BytesPool, 17),
} }
} }
func (puller *HDLPuller) Disconnect() {
if puller.Closer != nil {
puller.Closer.Close()
}
}
func (puller *HDLPuller) Connect() (err error) { func (puller *HDLPuller) Connect() (err error) {
HDLPlugin.Info("connect", zap.String("remoteURL", puller.RemoteURL)) HDLPlugin.Info("connect", zap.String("remoteURL", puller.RemoteURL))
if strings.HasPrefix(puller.RemoteURL, "http") { if strings.HasPrefix(puller.RemoteURL, "http") {