mirror of
https://github.com/jech/galene.git
synced 2024-11-09 02:05:59 +01:00
Fix loss statistics on NACK.
Since we don't use a separate RTX SSID, we must explicitly account for NACKed packets in our loss statistics.
This commit is contained in:
parent
8da55c6e6c
commit
f0cf9ae141
1 changed files with 5 additions and 3 deletions
|
@ -260,14 +260,15 @@ func (cache *Cache) Store(seqno uint16, timestamp uint32, keyframe bool, marker
|
|||
cache.lastValid = true
|
||||
cache.expected++
|
||||
} else {
|
||||
if compare(cache.last, seqno) <= 0 {
|
||||
cmp := compare(cache.last, seqno)
|
||||
if cmp < 0 {
|
||||
cache.expected += uint32(seqno - cache.last)
|
||||
cache.lost += uint32(seqno - cache.last - 1)
|
||||
if seqno < cache.last {
|
||||
cache.cycle++
|
||||
}
|
||||
cache.last = seqno
|
||||
} else {
|
||||
} else if cmp > 0 {
|
||||
if cache.lost > 0 {
|
||||
cache.lost--
|
||||
}
|
||||
|
@ -346,7 +347,7 @@ func completeKeyframe(cache *Cache) {
|
|||
}
|
||||
}
|
||||
|
||||
// Expect records that we expect n packets. It is used for loss statistics.
|
||||
// Expect records that we expect n additional packets.
|
||||
func (cache *Cache) Expect(n int) {
|
||||
if n <= 0 {
|
||||
return
|
||||
|
@ -354,6 +355,7 @@ func (cache *Cache) Expect(n int) {
|
|||
cache.mu.Lock()
|
||||
defer cache.mu.Unlock()
|
||||
cache.expected += uint32(n)
|
||||
cache.lost++
|
||||
}
|
||||
|
||||
// get retrieves a packet from a slice of entries.
|
||||
|
|
Loading…
Reference in a new issue