解决扩缩ringbuffer的bug

This commit is contained in:
李宇翔
2021-07-09 17:47:07 +08:00
parent a8d528b14a
commit 84fef0761a
3 changed files with 22 additions and 28 deletions

View File

@@ -25,7 +25,6 @@ type Subscriber struct {
SubscribeArgs url.Values
OnAudio func(pack AudioPack) `json:"-"`
OnVideo func(pack VideoPack) `json:"-"`
ByteStreamFormat bool
closeOnce sync.Once
}
@@ -137,7 +136,7 @@ func (s *Subscriber) PlayAudio(at *AudioTrack) {
}
}
send = func() {
if s.OnAudio(ap.Copy(startTimestamp)); at.lastTs -ap.Timestamp > 1000 {
if s.OnAudio(ap.Copy(startTimestamp)); at.lastTs-ap.Timestamp > 1000 {
action = drop
}
}
@@ -181,7 +180,7 @@ func (s *Subscriber) PlayVideo(vt *VideoTrack) {
}
}
send = func() {
if s.OnVideo(vp.Copy(startTimestamp)); vt.lastTs - vp.Timestamp > 1000 {
if s.OnVideo(vp.Copy(startTimestamp)); vt.lastTs-vp.Timestamp > 1000 {
action = drop
}
}