mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Fix TotalLost value in receiver reports.
This commit is contained in:
parent
100f72e76c
commit
5715182978
3 changed files with 8 additions and 5 deletions
|
@ -395,7 +395,7 @@ func sendRR(c *client, conn *upConnection) error {
|
||||||
|
|
||||||
reports := make([]rtcp.ReceptionReport, 0, len(conn.tracks))
|
reports := make([]rtcp.ReceptionReport, 0, len(conn.tracks))
|
||||||
for _, t := range 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 {
|
if expected == 0 {
|
||||||
expected = 1
|
expected = 1
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ func sendRR(c *client, conn *upConnection) error {
|
||||||
SSRC: t.track.SSRC(),
|
SSRC: t.track.SSRC(),
|
||||||
LastSenderReport: atomic.LoadUint32(&t.lastSenderReport),
|
LastSenderReport: atomic.LoadUint32(&t.lastSenderReport),
|
||||||
FractionLost: uint8((lost * 256) / expected),
|
FractionLost: uint8((lost * 256) / expected),
|
||||||
TotalLost: lost,
|
TotalLost: totalLost,
|
||||||
LastSequenceNumber: eseqno,
|
LastSequenceNumber: eseqno,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
2
group.go
2
group.go
|
@ -698,7 +698,7 @@ func getClientStats(c *client) clientStats {
|
||||||
for _, up := range c.up {
|
for _, up := range c.up {
|
||||||
conns := connStats{id: up.id}
|
conns := connStats{id: up.id}
|
||||||
for _, t := range up.tracks {
|
for _, t := range up.tracks {
|
||||||
expected, lost, _ := t.cache.GetStats(false)
|
expected, lost, _, _ := t.cache.GetStats(false)
|
||||||
if expected == 0 {
|
if expected == 0 {
|
||||||
expected = 1
|
expected = 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ type Cache struct {
|
||||||
lastValid bool
|
lastValid bool
|
||||||
expected uint32
|
expected uint32
|
||||||
lost uint32
|
lost uint32
|
||||||
|
totalLost uint32
|
||||||
// bitmap
|
// bitmap
|
||||||
first uint16
|
first uint16
|
||||||
bitmap uint32
|
bitmap uint32
|
||||||
|
@ -151,17 +152,19 @@ func (cache *Cache) BitmapGet() (uint16, uint16) {
|
||||||
return first, bitmap
|
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()
|
cache.mu.Lock()
|
||||||
defer cache.mu.Unlock()
|
defer cache.mu.Unlock()
|
||||||
|
|
||||||
expected := cache.expected
|
expected := cache.expected
|
||||||
lost := cache.lost
|
lost := cache.lost
|
||||||
|
totalLost := cache.totalLost + cache.lost
|
||||||
eseqno := uint32(cache.cycle)<<16 | uint32(cache.last)
|
eseqno := uint32(cache.cycle)<<16 | uint32(cache.last)
|
||||||
|
|
||||||
if reset {
|
if reset {
|
||||||
cache.expected = 0
|
cache.expected = 0
|
||||||
|
cache.totalLost += cache.lost
|
||||||
cache.lost = 0
|
cache.lost = 0
|
||||||
}
|
}
|
||||||
return expected, lost, eseqno
|
return expected, lost, totalLost, eseqno
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue