From e19a8708bdcaa68dda66e635f1db586aa797a7bc Mon Sep 17 00:00:00 2001 From: yangjiechina <1534796060@qq.com> Date: Sun, 11 Aug 2024 13:09:53 +0800 Subject: [PATCH] =?UTF-8?q?rtmp=E6=8E=A8=E6=8B=89=E6=B5=81=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E7=BB=93=E6=9E=9C,=20=E4=B8=8D=E5=86=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=AE=A1=E9=81=93=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtmp/rtmp_session.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtmp/rtmp_session.go b/rtmp/rtmp_session.go index 202ee28..4d7a017 100644 --- a/rtmp/rtmp_session.go +++ b/rtmp/rtmp_session.go @@ -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()) streamName, values := stream.ParseUrl(stream_) @@ -54,10 +54,10 @@ func (s *Session) OnPublish(app, stream_ string, response chan utils.HookState) 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_) sourceId := s.generateSourceId(app, streamName) @@ -73,7 +73,7 @@ func (s *Session) OnPlay(app, stream_ string, response chan utils.HookState) { s.handle = sink } - response <- state + return state } func (s *Session) Input(conn net.Conn, data []byte) error {