1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-12-22 15:25:48 +01:00

Fix TotalLost value in receiver reports.

This commit is contained in:
Juliusz Chroboczek 2020-05-01 04:41:15 +02:00
parent 100f72e76c
commit 5715182978
3 changed files with 8 additions and 5 deletions

View file

@ -395,7 +395,7 @@ func sendRR(c *client, conn *upConnection) error {
reports := make([]rtcp.ReceptionReport, 0, len(conn.tracks))
for _, t := range conn.tracks {
expected, lost, eseqno := t.cache.GetStats(true)
expected, lost, totalLost, eseqno := t.cache.GetStats(true)
if expected == 0 {
expected = 1
}
@ -406,7 +406,7 @@ func sendRR(c *client, conn *upConnection) error {
SSRC: t.track.SSRC(),
LastSenderReport: atomic.LoadUint32(&t.lastSenderReport),
FractionLost: uint8((lost * 256) / expected),
TotalLost: lost,
TotalLost: totalLost,
LastSequenceNumber: eseqno,
})
}

View file

@ -698,7 +698,7 @@ func getClientStats(c *client) clientStats {
for _, up := range c.up {
conns := connStats{id: up.id}
for _, t := range up.tracks {
expected, lost, _ := t.cache.GetStats(false)
expected, lost, _, _ := t.cache.GetStats(false)
if expected == 0 {
expected = 1
}

View file

@ -20,6 +20,7 @@ type Cache struct {
lastValid bool
expected uint32
lost uint32
totalLost uint32
// bitmap
first uint16
bitmap uint32
@ -151,17 +152,19 @@ func (cache *Cache) BitmapGet() (uint16, uint16) {
return first, bitmap
}
func (cache *Cache) GetStats(reset bool) (uint32, uint32, uint32) {
func (cache *Cache) GetStats(reset bool) (uint32, uint32, uint32, uint32) {
cache.mu.Lock()
defer cache.mu.Unlock()
expected := cache.expected
lost := cache.lost
totalLost := cache.totalLost + cache.lost
eseqno := uint32(cache.cycle)<<16 | uint32(cache.last)
if reset {
cache.expected = 0
cache.totalLost += cache.lost
cache.lost = 0
}
return expected, lost, eseqno
return expected, lost, totalLost, eseqno
}