rtsp server: log decode errors

This commit is contained in:
aler9 2022-10-31 19:16:13 +01:00
parent 584cc9357a
commit f7fdd60966
2 changed files with 14 additions and 1 deletions

View File

@ -389,7 +389,7 @@ func (s *rtspServer) OnPause(ctx *gortsplib.ServerHandlerOnPauseCtx) (*base.Resp
return se.onPause(ctx)
}
// OnPacketRTP implements gortsplib.ServerHandlerOnPacket.
// OnPacketRTP implements gortsplib.ServerHandlerOnPacketRTP.
func (s *rtspServer) OnPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) {
s.mutex.RLock()
se := s.sessions[ctx.Session]
@ -397,6 +397,14 @@ func (s *rtspServer) OnPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) {
se.onPacketRTP(ctx)
}
// OnDecodeError implements gortsplib.ServerHandlerOnOnDecodeError.
func (s *rtspServer) OnDecodeError(ctx *gortsplib.ServerHandlerOnDecodeErrorCtx) {
s.mutex.RLock()
se := s.sessions[ctx.Session]
s.mutex.RUnlock()
se.onDecodeError(ctx)
}
// apiSessionsList is called by api and metrics.
func (s *rtspServer) apiSessionsList(req rtspServerAPISessionsListReq) rtspServerAPISessionsListRes {
select {

View File

@ -394,3 +394,8 @@ func (s *rtspSession) onPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) {
})
}
}
// onDecodeError is called by rtspServer.
func (s *rtspSession) onDecodeError(ctx *gortsplib.ServerHandlerOnDecodeErrorCtx) {
s.log(logger.Warn, "%v", ctx.Error)
}