mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Add WriteRTP and Accumulate methods to downTrack.
This commit is contained in:
parent
d45d111084
commit
9488d4a7c8
2 changed files with 11 additions and 2 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
9
conn.go
9
conn.go
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue