Fixed RTSP ffmpeg compatibility

This commit is contained in:
Jonas Köritz 2019-09-03 16:03:46 +02:00
parent 6570ac93c0
commit 60e6179727
2 changed files with 3 additions and 2 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
*.jpeg *.jpeg
actioncam actioncam
*.prof *.prof
.vscode/

View file

@ -89,7 +89,7 @@ func (s *Server) handleRequest(packet []string, conn net.Conn) {
for _, header := range packet[1:] { for _, header := range packet[1:] {
parts := strings.Split(header, ":") parts := strings.Split(header, ":")
if len(parts) >= 2 { if len(parts) >= 2 {
headers[parts[0]] = strings.Join(parts[1:], ":") headers[parts[0]] = strings.TrimSpace(strings.Join(parts[1:], ":"))
} }
} }
@ -105,7 +105,7 @@ func (s *Server) handleRequest(packet []string, conn net.Conn) {
replyCSeq(conn, headers) replyCSeq(conn, headers)
writeHeader(conn, "Content-Type", "application/sdp") writeHeader(conn, "Content-Type", "application/sdp")
writeHeader(conn, "Content-Length", fmt.Sprintf("%d", len(s.sdp))) writeHeader(conn, "Content-Length", fmt.Sprintf("%d", len(s.sdp)))
conn.Write([]byte(fmt.Sprintf("\r\n%s\r\n", s.sdp))) conn.Write([]byte(fmt.Sprintf("\r\n%s", s.sdp)))
case "SETUP": case "SETUP":
transportDescription := strings.Split(headers["Transport"], ";") transportDescription := strings.Split(headers["Transport"], ";")
rtpDescription := transportDescription[len(transportDescription)-1] rtpDescription := transportDescription[len(transportDescription)-1]