remove useless checks (#4213)

This commit is contained in:
Alessandro Ros
2025-01-31 20:57:50 +01:00
committed by GitHub
parent 80879f6baa
commit 5cb5dc4e12
3 changed files with 2 additions and 12 deletions
-3
View File
@@ -214,9 +214,6 @@ func (c *conn) handleAuthError(authErr error) (*base.Response, error) {
func (c *conn) apiItem() *defs.APIRTSPConn {
stats := c.rconn.Stats()
if stats == nil {
stats = &gortsplib.StatsConn{}
}
return &defs.APIRTSPConn{
ID: c.uuid,
-3
View File
@@ -379,9 +379,6 @@ func (s *session) apiItem() *defs.APIRTSPSession {
defer s.mutex.Unlock()
stats := s.rsession.Stats()
if stats == nil {
stats = &gortsplib.StatsSession{}
}
return &defs.APIRTSPSession{
ID: s.uuid,
+2 -6
View File
@@ -98,15 +98,11 @@ func (s *Stream) BytesSent() uint64 {
bytesSent := atomic.LoadUint64(s.bytesSent)
if s.rtspStream != nil {
stats := s.rtspStream.Stats()
if stats != nil {
bytesSent += stats.BytesSent
}
bytesSent += stats.BytesSent
}
if s.rtspsStream != nil {
stats := s.rtspsStream.Stats()
if stats != nil {
bytesSent += stats.BytesSent
}
bytesSent += stats.BytesSent
}
return bytesSent
}