|
|
|
@ -869,7 +869,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { |
|
|
|
frame.Content = frame.Content[:cap(frame.Content)] |
|
|
|
frame.Content = frame.Content[:cap(frame.Content)] |
|
|
|
c.readCurBuf = !c.readCurBuf |
|
|
|
c.readCurBuf = !c.readCurBuf |
|
|
|
|
|
|
|
|
|
|
|
err := c.conn.ReadInterleavedFrame(frame) |
|
|
|
recv, err := c.conn.ReadInterleavedFrameOrRequest(frame) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if err != io.EOF { |
|
|
|
if err != io.EOF { |
|
|
|
c.log("ERR: %s", err) |
|
|
|
c.log("ERR: %s", err) |
|
|
|
@ -877,6 +877,8 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch recvt := recv.(type) { |
|
|
|
|
|
|
|
case *gortsplib.InterleavedFrame: |
|
|
|
trackId, trackFlowType := interleavedChannelToTrack(frame.Channel) |
|
|
|
trackId, trackFlowType := interleavedChannelToTrack(frame.Channel) |
|
|
|
|
|
|
|
|
|
|
|
if trackId >= len(c.streamTracks) { |
|
|
|
if trackId >= len(c.streamTracks) { |
|
|
|
@ -890,6 +892,25 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { |
|
|
|
trackFlowType, |
|
|
|
trackFlowType, |
|
|
|
frame.Content, |
|
|
|
frame.Content, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case *gortsplib.Request: |
|
|
|
|
|
|
|
cseq, ok := recvt.Header["CSeq"] |
|
|
|
|
|
|
|
if !ok || len(cseq) != 1 { |
|
|
|
|
|
|
|
c.writeResError(recvt, gortsplib.StatusBadRequest, fmt.Errorf("cseq missing")) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch recvt.Method { |
|
|
|
|
|
|
|
case gortsplib.TEARDOWN: |
|
|
|
|
|
|
|
// close connection silently
|
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
c.writeResError(recvt, gortsplib.StatusBadRequest, fmt.Errorf("unhandled method '%s'", recvt.Method)) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
c.udpLastFrameTime = time.Now() |
|
|
|
c.udpLastFrameTime = time.Now() |
|
|
|
|