Skip to content

Commit

Permalink
Remove unnecessary casts
Browse files Browse the repository at this point in the history
Don't need to cast nil to a pointer
  • Loading branch information
Sean-Der committed Apr 16, 2024
1 parent ace759a commit c19dc46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/jitterbuffer/jitter_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (jb *JitterBuffer) Pop() (*rtp.Packet, error) {
if err != nil {
jb.stats.underflowCount++
jb.emit(BufferUnderflow)
return (*rtp.Packet)(nil), err
return nil, err
}
jb.playoutHead = (jb.playoutHead + 1) % math.MaxUint16
jb.updateState()
Expand All @@ -231,7 +231,7 @@ func (jb *JitterBuffer) PopAtSequence(sq uint16) (*rtp.Packet, error) {
if err != nil {
jb.stats.underflowCount++
jb.emit(BufferUnderflow)
return (*rtp.Packet)(nil), err
return nil, err
}
jb.playoutHead = (jb.playoutHead + 1) % math.MaxUint16
jb.updateState()
Expand All @@ -245,7 +245,7 @@ func (jb *JitterBuffer) PeekAtSequence(sq uint16) (*rtp.Packet, error) {
defer jb.mutex.Unlock()
packet, err := jb.packets.Find(sq)
if err != nil {
return (*rtp.Packet)(nil), err
return nil, err
}
return packet, nil
}
Expand All @@ -262,7 +262,7 @@ func (jb *JitterBuffer) PopAtTimestamp(ts uint32) (*rtp.Packet, error) {
if err != nil {
jb.stats.underflowCount++
jb.emit(BufferUnderflow)
return (*rtp.Packet)(nil), err
return nil, err
}
jb.updateState()
return packet, nil
Expand Down

0 comments on commit c19dc46

Please sign in to comment.