1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-12-22 23:35:46 +01:00

Add WriteRTP and Accumulate methods to downTrack.

This commit is contained in:
Juliusz Chroboczek 2020-05-26 16:50:20 +02:00
parent d45d111084
commit 9488d4a7c8
2 changed files with 11 additions and 2 deletions

View file

@ -492,14 +492,14 @@ func writeLoop(conn *upConnection, track *upTrack, ch <-chan packetIndex) {
}
for _, l := range local {
err := l.track.WriteRTP(&packet)
err := l.WriteRTP(&packet)
if err != nil {
if err != io.ErrClosedPipe {
log.Printf("WriteRTP: %v", err)
}
continue
}
l.rate.Add(uint32(bytes))
l.Accumulate(uint32(bytes))
}
}
}

View file

@ -14,6 +14,7 @@ import (
"sfu/jitter"
"sfu/packetcache"
"github.com/pion/rtp"
"github.com/pion/webrtc/v2"
)
@ -247,6 +248,14 @@ type downTrack struct {
stats *receiverStats
}
func (down *downTrack) WriteRTP(packet *rtp.Packet) error {
return down.track.WriteRTP(packet)
}
func (down *downTrack) Accumulate(bytes uint32) {
down.rate.Add(bytes)
}
func (down *downTrack) GetMaxBitrate(now uint64) uint64 {
br1 := down.maxLossBitrate.Get(now)
br2 := down.maxREMBBitrate.Get(now)