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:
@@ -57,7 +57,6 @@ type MediaTrack struct {
|
||||
}
|
||||
|
||||
type MediaTrackParams struct {
|
||||
BaseTime time.Time
|
||||
SignalCid string
|
||||
SdpCid string
|
||||
ParticipantID livekit.ParticipantID
|
||||
@@ -277,7 +276,6 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
|
||||
|
||||
newWR := sfu.NewWebRTCReceiver(
|
||||
receiver,
|
||||
t.params.BaseTime,
|
||||
track,
|
||||
ti,
|
||||
LoggerWithCodecMime(t.params.Logger, mime),
|
||||
|
||||
@@ -108,7 +108,6 @@ func (p participantUpdateInfo) String() string {
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
type ParticipantParams struct {
|
||||
BaseTime time.Time
|
||||
Identity livekit.ParticipantIdentity
|
||||
Name livekit.ParticipantName
|
||||
SID livekit.ParticipantID
|
||||
@@ -288,9 +287,8 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
||||
),
|
||||
tracksQuality: make(map[livekit.TrackID]livekit.ConnectionQuality),
|
||||
metricTimestamper: metric.NewMetricTimestamper(metric.MetricTimestamperParams{
|
||||
Config: params.MetricConfig.Timestamper,
|
||||
BaseTime: params.BaseTime,
|
||||
Logger: params.Logger,
|
||||
Config: params.MetricConfig.Timestamper,
|
||||
Logger: params.Logger,
|
||||
}),
|
||||
pubLogger: params.Logger.WithComponent(sutils.ComponentPub),
|
||||
subLogger: params.Logger.WithComponent(sutils.ComponentSub),
|
||||
@@ -2322,7 +2320,6 @@ func (p *ParticipantImpl) addMigratedTrack(cid string, ti *livekit.TrackInfo) *M
|
||||
|
||||
func (p *ParticipantImpl) addMediaTrack(signalCid string, sdpCid string, ti *livekit.TrackInfo) *MediaTrack {
|
||||
mt := NewMediaTrack(MediaTrackParams{
|
||||
BaseTime: p.params.BaseTime,
|
||||
SignalCid: signalCid,
|
||||
SdpCid: sdpCid,
|
||||
ParticipantID: p.params.SID,
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user