Browse Source

fix: allow publishing with RTP/AVP

pull/2/head
aler9 6 years ago
parent
commit
e78f3f22a0
  1. 24
      client.go

24
client.go

@ -358,13 +358,13 @@ func (c *client) handleRequest(req *rtsp.Request) bool {
return true return true
case "SETUP": case "SETUP":
transportstr, ok := req.Headers["Transport"] transportStr, ok := req.Headers["Transport"]
if !ok { if !ok {
c.writeResError(req, fmt.Errorf("transport header missing")) c.writeResError(req, fmt.Errorf("transport header missing"))
return false return false
} }
th := newTransportHeader(transportstr) th := newTransportHeader(transportStr)
if _, ok := th["unicast"]; !ok { if _, ok := th["unicast"]; !ok {
c.writeResError(req, fmt.Errorf("transport header does not contain unicast")) c.writeResError(req, fmt.Errorf("transport header does not contain unicast"))
@ -388,7 +388,7 @@ func (c *client) handleRequest(req *rtsp.Request) bool {
}() { }() {
rtpPort, rtcpPort := th.getClientPorts() rtpPort, rtcpPort := th.getClientPorts()
if rtpPort == 0 || rtcpPort == 0 { if rtpPort == 0 || rtcpPort == 0 {
c.writeResError(req, fmt.Errorf("transport header does not have valid client ports (%s)", transportstr)) c.writeResError(req, fmt.Errorf("transport header does not have valid client ports (%s)", transportStr))
return false return false
} }
@ -502,7 +502,7 @@ func (c *client) handleRequest(req *rtsp.Request) bool {
return true return true
} else { } else {
c.writeResError(req, fmt.Errorf("transport header does not contain a valid protocol (RTP/AVP or RTP/AVP/TCP) (%s)", transportstr)) c.writeResError(req, fmt.Errorf("transport header does not contain a valid protocol (RTP/AVP, RTP/AVP/UDP or RTP/AVP/TCP) (%s)", transportStr))
return false return false
} }
@ -519,10 +519,20 @@ func (c *client) handleRequest(req *rtsp.Request) bool {
} }
// record via UDP // record via UDP
if _, ok := th["RTP/AVP/UDP"]; ok { if func() bool {
_, ok := th["RTP/AVP"]
if ok {
return true
}
_, ok = th["RTP/AVP/UDP"]
if ok {
return true
}
return false
}(); ok {
rtpPort, rtcpPort := th.getClientPorts() rtpPort, rtcpPort := th.getClientPorts()
if rtpPort == 0 || rtcpPort == 0 { if rtpPort == 0 || rtcpPort == 0 {
c.writeResError(req, fmt.Errorf("transport header does not have valid client ports (%s)", transportstr)) c.writeResError(req, fmt.Errorf("transport header does not have valid client ports (%s)", transportStr))
return false return false
} }
@ -623,7 +633,7 @@ func (c *client) handleRequest(req *rtsp.Request) bool {
return true return true
} else { } else {
c.writeResError(req, fmt.Errorf("transport header does not contain a valid protocol (RTP/AVP or RTP/AVP/TCP) (%s)", transportstr)) c.writeResError(req, fmt.Errorf("transport header does not contain a valid protocol (RTP/AVP, RTP/AVP/UDP or RTP/AVP/TCP) (%s)", transportStr))
return false return false
} }

Loading…
Cancel
Save