1
Fork 0

Rename rate.Add to rate.Accumulate.

This commit is contained in:
Juliusz Chroboczek 2020-05-31 23:47:12 +02:00
parent c4284a45c5
commit 70dee15f5c
4 changed files with 6 additions and 6 deletions

View File

@ -286,7 +286,7 @@ func (down *rtpDownTrack) WriteRTP(packet *rtp.Packet) error {
}
func (down *rtpDownTrack) Accumulate(bytes uint32) {
down.rate.Add(bytes)
down.rate.Accumulate(bytes)
}
func (down *rtpDownTrack) GetMaxBitrate(now uint64) uint64 {

View File

@ -33,7 +33,7 @@ func (e *Estimator) swap(now time.Time) {
e.time = now
}
func (e *Estimator) Add(count uint32) {
func (e *Estimator) Accumulate(count uint32) {
atomic.AddUint32(&e.count, count)
}

View File

@ -10,8 +10,8 @@ func TestEstimator(t *testing.T) {
e := New(time.Second)
e.estimate(now)
e.Add(42)
e.Add(128)
e.Accumulate(42)
e.Accumulate(128)
e.estimate(now.Add(time.Second))
rate := e.estimate(now.Add(time.Second + time.Millisecond))

View File

@ -422,7 +422,7 @@ func readLoop(conn *upConnection, track *upTrack) {
}
break
}
track.rate.Add(uint32(bytes))
track.rate.Accumulate(uint32(bytes))
err = packet.Unmarshal(buf[:bytes])
if err != nil {
@ -1050,7 +1050,7 @@ func sendRecovery(p *rtcp.TransportLayerNack, track *rtpDownTrack) {
log.Printf("WriteRTP: %v", err)
continue
}
track.rate.Add(uint32(l))
track.rate.Accumulate(uint32(l))
}
}
}