mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-10-28 01:12:30 +08:00
fix: push proxy push on publish
This commit is contained in:
@@ -197,9 +197,7 @@ func (p *Publisher) Start() (err error) {
|
||||
|
||||
s.Waiting.WakeUp(p.StreamPath, p)
|
||||
p.processAliasOnStart()
|
||||
for plugin := range s.Plugins.Range {
|
||||
plugin.OnPublish(p)
|
||||
}
|
||||
p.Plugin.Server.OnPublish(p)
|
||||
//s.Transforms.PublishEvent <- p
|
||||
p.AddTask(&PublishTimeout{Publisher: p})
|
||||
if p.PublishTimeout > 0 {
|
||||
|
||||
@@ -108,8 +108,17 @@ func (d *PushProxy) ChangeStatus(status byte) {
|
||||
d.Update()
|
||||
switch status {
|
||||
case PushProxyStatusOnline:
|
||||
if d.PushOnStart && from == PushProxyStatusOffline {
|
||||
d.Handler.Push()
|
||||
if from == PushProxyStatusOffline {
|
||||
if d.PushOnStart {
|
||||
d.Handler.Push()
|
||||
} else {
|
||||
d.server.Streams.Call(func() error {
|
||||
if d.server.Streams.Has(d.GetStreamPath()) {
|
||||
d.Handler.Push()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
server.go
11
server.go
@@ -569,6 +569,17 @@ func (s *Server) Dispose() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) OnPublish(p *Publisher) {
|
||||
for plugin := range s.Plugins.Range {
|
||||
plugin.OnPublish(p)
|
||||
}
|
||||
for pushProxy := range s.PushProxies.Range {
|
||||
if pushProxy.Status == PushProxyStatusOnline && pushProxy.GetStreamPath() == p.StreamPath && !pushProxy.PushOnStart {
|
||||
pushProxy.Handler.Push()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) OnSubscribe(streamPath string, args url.Values) {
|
||||
for plugin := range s.Plugins.Range {
|
||||
plugin.OnSubscribe(streamPath, args)
|
||||
|
||||
Reference in New Issue
Block a user