mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-10-28 05:22:04 +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)
|
s.Waiting.WakeUp(p.StreamPath, p)
|
||||||
p.processAliasOnStart()
|
p.processAliasOnStart()
|
||||||
for plugin := range s.Plugins.Range {
|
p.Plugin.Server.OnPublish(p)
|
||||||
plugin.OnPublish(p)
|
|
||||||
}
|
|
||||||
//s.Transforms.PublishEvent <- p
|
//s.Transforms.PublishEvent <- p
|
||||||
p.AddTask(&PublishTimeout{Publisher: p})
|
p.AddTask(&PublishTimeout{Publisher: p})
|
||||||
if p.PublishTimeout > 0 {
|
if p.PublishTimeout > 0 {
|
||||||
|
|||||||
@@ -108,8 +108,17 @@ func (d *PushProxy) ChangeStatus(status byte) {
|
|||||||
d.Update()
|
d.Update()
|
||||||
switch status {
|
switch status {
|
||||||
case PushProxyStatusOnline:
|
case PushProxyStatusOnline:
|
||||||
if d.PushOnStart && from == PushProxyStatusOffline {
|
if from == PushProxyStatusOffline {
|
||||||
d.Handler.Push()
|
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) {
|
func (s *Server) OnSubscribe(streamPath string, args url.Values) {
|
||||||
for plugin := range s.Plugins.Range {
|
for plugin := range s.Plugins.Range {
|
||||||
plugin.OnSubscribe(streamPath, args)
|
plugin.OnSubscribe(streamPath, args)
|
||||||
|
|||||||
Reference in New Issue
Block a user