Skip to content

Commit

Permalink
remove useless checks (#4213)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Jan 31, 2025
1 parent 80879f6 commit 5cb5dc4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
3 changes: 0 additions & 3 deletions internal/servers/rtsp/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions internal/servers/rtsp/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions internal/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5cb5dc4

Please sign in to comment.