feat: add speed play

This commit is contained in:
langhuihui
2024-04-12 17:48:26 +08:00
parent 51c85d10f7
commit d06d068f99
10 changed files with 196 additions and 51 deletions

View File

@@ -20,6 +20,12 @@ type HDLPuller struct {
pool *util.ScalableMemoryAllocator
}
func NewHDLPuller() *HDLPuller {
return &HDLPuller{
pool: util.NewScalableMemoryAllocator(1024),
}
}
func (puller *HDLPuller) Connect(p *m7s.Puller) (err error) {
if strings.HasPrefix(p.RemoteURL, "http") {
var res *http.Response
@@ -88,8 +94,10 @@ func (puller *HDLPuller) Pull(p *m7s.Puller) (err error) {
mem := frame.Malloc(int(dataSize))
_, err = io.ReadFull(puller, mem)
if err != nil {
frame.Recycle()
return
}
frame.ReadFromBytes(mem)
puller.absTS = offsetTs + (timestamp - startTs)
frame.Timestamp = puller.absTS
// fmt.Println(t, offsetTs, timestamp, startTs, puller.absTS)