mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-09-26 19:51:14 +08:00
适配3.3
This commit is contained in:
8
go.mod
8
go.mod
@@ -3,9 +3,9 @@ module github.com/Monibuca/plugin-rtsp/v3
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/Monibuca/engine/v3 v3.2.0
|
||||
github.com/Monibuca/utils/v3 v3.0.0
|
||||
github.com/pion/rtp v1.6.5
|
||||
github.com/Monibuca/engine/v3 v3.3.0
|
||||
github.com/Monibuca/utils/v3 v3.0.2
|
||||
github.com/pion/rtp v1.7.1
|
||||
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect
|
||||
)
|
||||
|
9
go.sum
9
go.sum
@@ -2,8 +2,13 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Monibuca/engine/v3 v3.2.0 h1:gAaw/5NFKvC1w7e1xP4IddP5gdC7Puz75hwwoZmzEeE=
|
||||
github.com/Monibuca/engine/v3 v3.2.0/go.mod h1:yz6cssED2VlYu+g/LrxseBB9pcvsLM/o2QXa4gVY650=
|
||||
github.com/Monibuca/engine/v3 v3.3.0 h1:7zwYsLEHdeVZy6+JjVlaDhl/asr0HG6jirBL4uynj0s=
|
||||
github.com/Monibuca/engine/v3 v3.3.0/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g=
|
||||
github.com/Monibuca/utils/v3 v3.0.0 h1:i8qCXQPQpRPgjuXKu5C2PYiL5LYzB6GW4xE162mB2ug=
|
||||
github.com/Monibuca/utils/v3 v3.0.0/go.mod h1:RpNS95gapWs6gimwh8Xn2x72FN5tO7Powabj7dTFyvE=
|
||||
github.com/Monibuca/utils/v3 v3.0.1/go.mod h1:RpNS95gapWs6gimwh8Xn2x72FN5tO7Powabj7dTFyvE=
|
||||
github.com/Monibuca/utils/v3 v3.0.2 h1:n2vr67DHanav8wBC9IENk8xrKzeGJnBsxYUu69s8TrQ=
|
||||
github.com/Monibuca/utils/v3 v3.0.2/go.mod h1:RpNS95gapWs6gimwh8Xn2x72FN5tO7Powabj7dTFyvE=
|
||||
github.com/cnotch/apirouter v0.0.0-20200731232942-89e243a791f3/go.mod h1:5deJPLON/x/s2dLOQfuKS0lenhOIT4xX0pvtN/OEIuY=
|
||||
github.com/cnotch/ipchub v1.1.0 h1:hH0lh2mU3AZXPiqMwA0pdtqrwo7PFIMRGush9OobMUs=
|
||||
github.com/cnotch/ipchub v1.1.0/go.mod h1:2PbeBs2q2VxxTVCn1eYCDwpAWuVXbq1+N0FU7GimOH4=
|
||||
@@ -40,6 +45,8 @@ github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TB
|
||||
github.com/pion/rtp v1.6.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
|
||||
github.com/pion/rtp v1.6.5 h1:o2cZf8OascA5HF/b0PAbTxRKvOWxTQxWYt7SlToxFGI=
|
||||
github.com/pion/rtp v1.6.5/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
|
||||
github.com/pion/rtp v1.7.1 h1:hCaxfVgPGt13eF/Tu9RhVn04c+dAcRZmhdDWqUE13oY=
|
||||
github.com/pion/rtp v1.7.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
|
||||
github.com/pixelbender/go-sdp v1.1.0/go.mod h1:6IBlz9+BrUHoFTea7gcp4S54khtOhjCW/nVDLhmZBAs=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@@ -68,6 +75,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
24
session.go
24
session.go
@@ -286,12 +286,12 @@ func (session *RTSP) handleRequest(req *Request) {
|
||||
at, vt := session.UDPClient.AT, session.UDPClient.VT
|
||||
if vt != nil {
|
||||
var st uint32
|
||||
onVideo := func(pack VideoPack) {
|
||||
onVideo := func(ts uint32, pack *VideoPack) {
|
||||
if session.UDPClient == nil {
|
||||
return
|
||||
}
|
||||
for _, nalu := range pack.NALUs {
|
||||
for _, pack := range session.UDPClient.VPacketizer.Packetize(nalu, (pack.Timestamp-st)*90) {
|
||||
for _, pack := range session.UDPClient.VPacketizer.Packetize(nalu, (ts-st)*90) {
|
||||
p := &RTPPack{
|
||||
Type: RTP_TYPE_VIDEO,
|
||||
Packet: *pack,
|
||||
@@ -300,23 +300,23 @@ func (session *RTSP) handleRequest(req *Request) {
|
||||
session.SendRTP(p)
|
||||
}
|
||||
}
|
||||
st = pack.Timestamp
|
||||
st = ts
|
||||
}
|
||||
sub.OnVideo = func(pack VideoPack) {
|
||||
if st = pack.Timestamp; st != 0 {
|
||||
sub.OnVideo = func(ts uint32, pack *VideoPack) {
|
||||
if st = ts; st != 0 {
|
||||
sub.OnVideo = onVideo
|
||||
}
|
||||
onVideo(pack)
|
||||
onVideo(ts, pack)
|
||||
}
|
||||
}
|
||||
if at != nil {
|
||||
tb := uint32(at.SoundRate / 1000)
|
||||
var st uint32
|
||||
onAudio := func(pack AudioPack) {
|
||||
onAudio := func(ts uint32, pack *AudioPack) {
|
||||
if session.UDPClient == nil {
|
||||
return
|
||||
}
|
||||
for _, pack := range session.UDPClient.APacketizer.Packetize(pack.Payload, (pack.Timestamp-st)*tb) {
|
||||
for _, pack := range session.UDPClient.APacketizer.Packetize(pack.Payload, (ts-st)*tb) {
|
||||
p := &RTPPack{
|
||||
Type: RTP_TYPE_VIDEO,
|
||||
Packet: *pack,
|
||||
@@ -324,13 +324,13 @@ func (session *RTSP) handleRequest(req *Request) {
|
||||
p.Raw, _ = p.Marshal()
|
||||
session.SendRTP(p)
|
||||
}
|
||||
st = pack.Timestamp
|
||||
st = ts
|
||||
}
|
||||
sub.OnAudio = func(pack AudioPack) {
|
||||
if st = pack.Timestamp; st != 0 {
|
||||
sub.OnAudio = func(ts uint32, pack *AudioPack) {
|
||||
if st = ts; st != 0 {
|
||||
sub.OnAudio = onAudio
|
||||
}
|
||||
onAudio(pack)
|
||||
onAudio(ts, pack)
|
||||
}
|
||||
}
|
||||
go sub.Play(at, vt)
|
||||
|
Reference in New Issue
Block a user