change rtptime.Encoder signature and initialize time to a random value (#525)

This commit is contained in:
Alessandro Ros
2024-02-25 23:25:44 +01:00
committed by GitHub
parent f040e20ac4
commit ce46aee084
3 changed files with 60 additions and 19 deletions

View File

@@ -45,7 +45,11 @@ func main() {
}
// setup timestamp generator
rtpTime := rtptime.NewEncoder(forma.ClockRate(), 0)
rtpTime := &rtptime.Encoder{ClockRate: forma.ClockRate()}
err = rtpTime.Initialize()
if err != nil {
panic(err)
}
start := time.Now()
// setup a ticker to sleep between frames
@@ -89,7 +93,7 @@ func main() {
}
// get current timestamp
ts := rtpTime.Encode(time.Now().Sub(start))
ts := rtpTime.Encode(time.Since(start))
// write packets to the server
for _, pkt := range pkts {