diff --git a/go.mod b/go.mod index 0d5bc48..4a9b2a1 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/Monibuca/plugin-rtmp go 1.13 require ( + github.com/Monibuca/engine v1.2.2 // indirect github.com/Monibuca/engine/v2 v2.0.0-alpha1 github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 ) diff --git a/go.sum b/go.sum index fd37db2..b83db63 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,9 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Monibuca/engine v1.2.2 h1:hNjsrZpOmui8lYhgCJ5ltJU8g/k0Rrdysx2tHNGGnbI= +github.com/Monibuca/engine v1.2.2/go.mod h1:WbDkXENLjcPjyjCR1Mix1GA+uAlwORkv/+8aMVrDX2g= +github.com/Monibuca/engine/v2 v2.0.0-alpha1 h1:RT+rKOJC1MdFNZp6gADGdzGLxEhYN35MKEAx7FwHtps= +github.com/Monibuca/engine/v2 v2.0.0-alpha1/go.mod h1:34EYjjV15G6myuHOKaJkO7y5tJ1Arq/NfC9Weacr2mc= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= diff --git a/netStream.go b/netStream.go index 6399ae6..eb9bebb 100644 --- a/netStream.go +++ b/netStream.go @@ -13,7 +13,7 @@ import ( ) type RTMP struct { - InputStream + Publisher } func ListenRtmp(addr string) error { @@ -167,7 +167,7 @@ func processRtmp(conn net.Conn) { err = nc.SendMessage(SEND_PLAY_RESPONSE_MESSAGE, newPlayResponseMessageData(nc.streamID, NetStream_Play_Start, Level_Status)) if err == nil { streams[nc.streamID] = stream - go stream.Play(streamPath) + go stream.Subscribe(streamPath) } else { return } @@ -185,7 +185,7 @@ func processRtmp(conn net.Conn) { } else { totalDuration += msg.Timestamp // 绝对时间戳 } - Stream.PushAudio(totalDuration, msg.Body) + stream.PushAudio(totalDuration, msg.Body) case RTMP_MSG_VIDEO: // pkt := avformat.NewAVPacket(RTMP_MSG_VIDEO) if msg.Timestamp == 0xffffff { @@ -193,7 +193,7 @@ func processRtmp(conn net.Conn) { } else { totalDuration += msg.Timestamp // 绝对时间戳 } - Stream.PushVideo(totalDuration, msg.Body) + stream.PushVideo(totalDuration, msg.Body) } msg.Recycle() } else {