mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-10-04 23:32:54 +08:00
解决rtsp推流无视频时的报错
This commit is contained in:
2
go.sum
2
go.sum
@@ -10,6 +10,7 @@ github.com/Monibuca/engine/v2 v2.2.0 h1:A4SyWwzVLegd8Oa6LfSW3LpNfBmWq+MHJJLO55gv
|
|||||||
github.com/Monibuca/engine/v2 v2.2.0/go.mod h1:34EYjjV15G6myuHOKaJkO7y5tJ1Arq/NfC9Weacr2mc=
|
github.com/Monibuca/engine/v2 v2.2.0/go.mod h1:34EYjjV15G6myuHOKaJkO7y5tJ1Arq/NfC9Weacr2mc=
|
||||||
github.com/Monibuca/plugin-rtp v0.0.0-20200531014802-504413c0dfcb h1:CnmoQ8XsWxs/6mulbQfTGUa8cPr6c/3bkkTsNozRBwE=
|
github.com/Monibuca/plugin-rtp v0.0.0-20200531014802-504413c0dfcb h1:CnmoQ8XsWxs/6mulbQfTGUa8cPr6c/3bkkTsNozRBwE=
|
||||||
github.com/Monibuca/plugin-rtp v0.0.0-20200531014802-504413c0dfcb/go.mod h1:8HxBilkF835Lepe/DLUCjaw1mRiu3MxTDsG7g9UcfZA=
|
github.com/Monibuca/plugin-rtp v0.0.0-20200531014802-504413c0dfcb/go.mod h1:8HxBilkF835Lepe/DLUCjaw1mRiu3MxTDsG7g9UcfZA=
|
||||||
|
github.com/Monibuca/plugin-rtp v1.0.0 h1:yksNsIIGxoKX8UZirkAUK+mGZ/XoEeS2vqbIqtqXyCg=
|
||||||
github.com/Monibuca/plugin-rtp v1.0.0/go.mod h1:0xkNm23a/BjVnEMz1zXyOqfEjoVmGe3PJqPNF1KyFGc=
|
github.com/Monibuca/plugin-rtp v1.0.0/go.mod h1:0xkNm23a/BjVnEMz1zXyOqfEjoVmGe3PJqPNF1KyFGc=
|
||||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
|
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/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||||
@@ -25,6 +26,7 @@ github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRn
|
|||||||
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||||
|
github.com/mask-pp/rtp-ps v1.0.0 h1:JFxuJL9N+gD1ldgJlAy3b7rYfY8wAVHi9ODNmdP4+EE=
|
||||||
github.com/mask-pp/rtp-ps v1.0.0/go.mod h1:jCxsZ2G7z/jX+aqFypEWMePnhNrfnUiXUEKm6Xp0vgU=
|
github.com/mask-pp/rtp-ps v1.0.0/go.mod h1:jCxsZ2G7z/jX+aqFypEWMePnhNrfnUiXUEKm6Xp0vgU=
|
||||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
|
12
session.go
12
session.go
@@ -319,9 +319,9 @@ func (session *RTSP) handleRequest(req *Request) {
|
|||||||
session.SDPMap = ParseSDP(req.Body)
|
session.SDPMap = ParseSDP(req.Body)
|
||||||
if session.Publish(streamPath) {
|
if session.Publish(streamPath) {
|
||||||
if session.ASdp, session.HasAudio = session.SDPMap["audio"]; session.HasAudio {
|
if session.ASdp, session.HasAudio = session.SDPMap["audio"]; session.HasAudio {
|
||||||
if len(session.ASdp.Control) >0 {
|
if len(session.ASdp.Control) > 0 {
|
||||||
session.WriteASC(session.ASdp.Config)
|
session.WriteASC(session.ASdp.Config)
|
||||||
}else{
|
} else {
|
||||||
session.setAudioFormat()
|
session.setAudioFormat()
|
||||||
}
|
}
|
||||||
Printf("audio codec[%s]\n", session.ASdp.Codec)
|
Printf("audio codec[%s]\n", session.ASdp.Codec)
|
||||||
@@ -379,7 +379,8 @@ func (session *RTSP) handleRequest(req *Request) {
|
|||||||
// res.Status = "Error Status"
|
// res.Status = "Error Status"
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
vPath := ""
|
var vPath, aPath string
|
||||||
|
if session.HasVideo {
|
||||||
if strings.Index(strings.ToLower(session.VSdp.Control), "rtsp://") == 0 {
|
if strings.Index(strings.ToLower(session.VSdp.Control), "rtsp://") == 0 {
|
||||||
vControlUrl, err := url.Parse(session.VSdp.Control)
|
vControlUrl, err := url.Parse(session.VSdp.Control)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -394,8 +395,8 @@ func (session *RTSP) handleRequest(req *Request) {
|
|||||||
} else {
|
} else {
|
||||||
vPath = session.VSdp.Control
|
vPath = session.VSdp.Control
|
||||||
}
|
}
|
||||||
|
}
|
||||||
aPath := ""
|
if session.HasAudio {
|
||||||
if strings.Index(strings.ToLower(session.ASdp.Control), "rtsp://") == 0 {
|
if strings.Index(strings.ToLower(session.ASdp.Control), "rtsp://") == 0 {
|
||||||
aControlUrl, err := url.Parse(session.ASdp.Control)
|
aControlUrl, err := url.Parse(session.ASdp.Control)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -410,6 +411,7 @@ func (session *RTSP) handleRequest(req *Request) {
|
|||||||
} else {
|
} else {
|
||||||
aPath = session.ASdp.Control
|
aPath = session.ASdp.Control
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mtcp := regexp.MustCompile("interleaved=(\\d+)(-(\\d+))?")
|
mtcp := regexp.MustCompile("interleaved=(\\d+)(-(\\d+))?")
|
||||||
mudp := regexp.MustCompile("client_port=(\\d+)(-(\\d+))?")
|
mudp := regexp.MustCompile("client_port=(\\d+)(-(\\d+))?")
|
||||||
|
Reference in New Issue
Block a user