rtmp推拉流回调结果, 不再使用管道传递

This commit is contained in:
yangjiechina
2024-08-11 13:09:53 +08:00
parent efded1d4db
commit e19a8708bd

View File

@@ -28,7 +28,7 @@ func (s *Session) generateSourceId(app, stream_ string) string {
} }
} }
func (s *Session) OnPublish(app, stream_ string, response chan utils.HookState) { func (s *Session) OnPublish(app, stream_ string) utils.HookState {
log.Sugar.Infof("rtmp onpublish app:%s stream:%s conn:%s", app, stream_, s.conn.RemoteAddr().String()) log.Sugar.Infof("rtmp onpublish app:%s stream:%s conn:%s", app, stream_, s.conn.RemoteAddr().String())
streamName, values := stream.ParseUrl(stream_) streamName, values := stream.ParseUrl(stream_)
@@ -54,10 +54,10 @@ func (s *Session) OnPublish(app, stream_ string, response chan utils.HookState)
go source.LoopEvent() go source.LoopEvent()
} }
response <- state return state
} }
func (s *Session) OnPlay(app, stream_ string, response chan utils.HookState) { func (s *Session) OnPlay(app, stream_ string) utils.HookState {
streamName, values := stream.ParseUrl(stream_) streamName, values := stream.ParseUrl(stream_)
sourceId := s.generateSourceId(app, streamName) sourceId := s.generateSourceId(app, streamName)
@@ -73,7 +73,7 @@ func (s *Session) OnPlay(app, stream_ string, response chan utils.HookState) {
s.handle = sink s.handle = sink
} }
response <- state return state
} }
func (s *Session) Input(conn net.Conn, data []byte) error { func (s *Session) Input(conn net.Conn, data []byte) error {