Use monotonic time util. (#3112)

Thank you @paulwe for doing this. I was promising to do this for a
while, but just like other times, empty promises :-(
This commit is contained in:
Raja Subramanian
2024-10-17 10:49:24 +05:30
committed by GitHub
parent 19c5ed6343
commit 40b10af960
14 changed files with 23 additions and 117 deletions
-11
View File
@@ -18,7 +18,6 @@ import (
"errors"
"strings"
"sync"
"time"
"github.com/pion/webrtc/v3"
"go.uber.org/atomic"
@@ -163,8 +162,6 @@ type DummyReceiver struct {
pausedValid bool
paused bool
baseTime time.Time
redReceiver, primaryReceiver *DummyRedReceiver
}
@@ -175,7 +172,6 @@ func NewDummyReceiver(trackID livekit.TrackID, streamId string, codec webrtc.RTP
codec: codec,
headerExtensions: headerExtensions,
downTracks: make(map[livekit.ParticipantID]sfu.TrackSender),
baseTime: time.Now(),
}
}
@@ -384,13 +380,6 @@ func (d *DummyReceiver) GetTrackStats() *livekit.RTPStats {
return nil
}
func (d *DummyReceiver) GetMonotonicNowUnixNano() int64 {
if r, ok := d.receiver.Load().(sfu.TrackReceiver); ok {
return r.GetMonotonicNowUnixNano()
}
return d.baseTime.Add(time.Since(d.baseTime)).UnixNano()
}
func (d *DummyReceiver) AddOnReady(f func()) {
var receiver sfu.TrackReceiver
d.downTrackLock.Lock()