From 70dee15f5c6712714257f42eb38c92ef51e68781 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sun, 31 May 2020 23:47:12 +0200 Subject: [PATCH] Rename rate.Add to rate.Accumulate. --- conn.go | 2 +- estimator/estimator.go | 2 +- estimator/estimator_test.go | 4 ++-- webclient.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conn.go b/conn.go index c11aebf..8fed8df 100644 --- a/conn.go +++ b/conn.go @@ -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 { diff --git a/estimator/estimator.go b/estimator/estimator.go index a5800a3..7ac8aa6 100644 --- a/estimator/estimator.go +++ b/estimator/estimator.go @@ -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) } diff --git a/estimator/estimator_test.go b/estimator/estimator_test.go index a0a9933..1fca1bc 100644 --- a/estimator/estimator_test.go +++ b/estimator/estimator_test.go @@ -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)) diff --git a/webclient.go b/webclient.go index b48a12e..b4eb4a5 100644 --- a/webclient.go +++ b/webclient.go @@ -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)) } } }