Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Camel authored and Camel committed Apr 20, 2023
1 parent 0699654 commit 39bedc4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkg/jitter/jitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ func (b *Jitter) Get() ([]*Packet, bool) {

b.adaptive()

targetTime := b.targetTime()

removeLessThan(b.list, targetTime)
removeLessThan(b.normal, targetTime-b.window)
removeLessThan(b.late, targetTime-b.window)
removeLessThan(b.loss, targetTime-b.window)
removeLessThan(b.list, b.targetTime())
removeLessThan(b.normal, b.targetTime()-b.window)
removeLessThan(b.late, b.targetTime()-b.window)
removeLessThan(b.loss, b.targetTime()-b.window)

var ret []*Packet

Expand All @@ -119,19 +117,19 @@ func (b *Jitter) Get() ([]*Packet, bool) {
}

pkt := node.Value.(*Packet)
if pkt.Timestamp >= targetTime+b.defaultTickInterval {
if pkt.Timestamp >= b.targetTime()+b.defaultTickInterval {
break
}

b.list.RemoveFront()
newTargetTime := pkt.Timestamp + pkt.SampleCnt
delta := newTargetTime - targetTime
delta := newTargetTime - b.targetTime()
b.current += delta
ret = append(ret, pkt)
}

if len(ret) == 0 {
b.loss.Set(targetTime, nil)
b.loss.Set(b.targetTime(), nil)
b.current += b.defaultTickInterval
return nil, false
}
Expand Down

0 comments on commit 39bedc4

Please sign in to comment.