Skip to content

Commit d207ce1

Browse files
authored
Log start time. (#739)
* Log start time and drop audio in pts disable config. PTS disable is not audio specific. So, changing it to just call it PTSAdjustmentDisabled. Changes the API a bit, but I think it is the correct usage as nothing in track synchroniser that is audio specific. * revert to audio
1 parent a5cfa30 commit d207ce1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

pkg/synchronizer/track.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,26 @@ func (t *TrackSynchronizer) Initialize(pkt *rtp.Packet) {
106106
t.lastTS = pkt.Timestamp
107107
t.lastPTS = 0
108108
t.lastPTSAdjusted = t.currentPTSOffset
109-
t.logger.Infow("initialized track synchronizer",
109+
t.logger.Infow(
110+
"initialized track synchronizer",
110111
"startRTP", t.startRTP,
111112
"currentPTSOffset", t.currentPTSOffset,
112113
)
113114
}
114115

115-
// GetPTS will reset sequence numbers and/or offsets if necessary
116+
// GetPTS will adjust PTS offsets if necessary
116117
// Packets are expected to be in order
117118
func (t *TrackSynchronizer) GetPTS(pkt *rtp.Packet) (time.Duration, error) {
118119
t.Lock()
119120
defer t.Unlock()
120121

121122
if t.startTime.IsZero() {
122123
t.startTime = time.Now()
124+
t.logger.Infow(
125+
"starting track synchronizer",
126+
"startRTP", t.startRTP,
127+
"currentPTSOffset", t.currentPTSOffset,
128+
)
123129
}
124130

125131
ts := pkt.Timestamp
@@ -131,8 +137,9 @@ func (t *TrackSynchronizer) GetPTS(pkt *rtp.Packet) (time.Duration, error) {
131137
estimatedPTS := time.Since(t.startTime)
132138
if pts < t.lastPTS || !t.acceptable(pts-estimatedPTS) {
133139
newStartRTP := ts - t.toRTP(estimatedPTS)
134-
t.logger.Infow("correcting PTS",
135-
"TS", ts,
140+
t.logger.Infow(
141+
"correcting PTS",
142+
"currentTS", ts,
136143
"lastTS", t.lastTS,
137144
"PTS", pts,
138145
"lastPTS", t.lastPTS,

0 commit comments

Comments
 (0)