Commit 9488d4a7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add WriteRTP and Accumulate methods to downTrack.

parent d45d1110
......@@ -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))
}
}
}
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment