Use Write instead of WriteRTP in the downTrack interface.

This commit is contained in:
Juliusz Chroboczek
2021-05-11 23:48:17 +02:00
parent b09dba0e26
commit c53cc20d26
4 changed files with 23 additions and 48 deletions
+4 -7
View File
@@ -89,15 +89,12 @@ type rtpDownTrack struct {
cname atomic.Value
}
func (down *rtpDownTrack) WriteRTP(packet *rtp.Packet) error {
err := down.track.WriteRTP(packet)
func (down *rtpDownTrack) Write(buf []byte) (int, error) {
n, err := down.track.Write(buf)
if err == nil {
// we should account for extensions
down.rate.Accumulate(
uint32(12 + 4*len(packet.CSRC) + len(packet.Payload)),
)
down.rate.Accumulate(uint32(n))
}
return err
return n, err
}
func (down *rtpDownTrack) SetTimeOffset(ntp uint64, rtp uint32) {