mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Move rate estimation into rtpDownTrack.WriteRTP.
This commit is contained in:
parent
c52e1f4ce0
commit
d3f53e6ada
4 changed files with 8 additions and 13 deletions
|
@ -39,7 +39,6 @@ type Down interface {
|
||||||
// Type DownTrack represents a track in the server to client direction.
|
// Type DownTrack represents a track in the server to client direction.
|
||||||
type DownTrack interface {
|
type DownTrack interface {
|
||||||
WriteRTP(packat *rtp.Packet) error
|
WriteRTP(packat *rtp.Packet) error
|
||||||
Accumulate(bytes uint32)
|
|
||||||
SetTimeOffset(ntp uint64, rtp uint32)
|
SetTimeOffset(ntp uint64, rtp uint32)
|
||||||
SetCname(string)
|
SetCname(string)
|
||||||
GetMaxBitrate() uint64
|
GetMaxBitrate() uint64
|
||||||
|
|
|
@ -603,7 +603,3 @@ func (conn *diskConn) initWriter(width, height uint32) error {
|
||||||
func (t *diskTrack) GetMaxBitrate() uint64 {
|
func (t *diskTrack) GetMaxBitrate() uint64 {
|
||||||
return ^uint64(0)
|
return ^uint64(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *diskTrack) Accumulate(bytes uint32) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
|
@ -90,11 +90,14 @@ type rtpDownTrack struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (down *rtpDownTrack) WriteRTP(packet *rtp.Packet) error {
|
func (down *rtpDownTrack) WriteRTP(packet *rtp.Packet) error {
|
||||||
return down.track.WriteRTP(packet)
|
err := down.track.WriteRTP(packet)
|
||||||
}
|
if err == nil {
|
||||||
|
// we should account for extensions
|
||||||
func (down *rtpDownTrack) Accumulate(bytes uint32) {
|
down.rate.Accumulate(
|
||||||
down.rate.Accumulate(bytes)
|
uint32(12 + 4*len(packet.CSRC) + len(packet.Payload)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (down *rtpDownTrack) SetTimeOffset(ntp uint64, rtp uint32) {
|
func (down *rtpDownTrack) SetTimeOffset(ntp uint64, rtp uint32) {
|
||||||
|
@ -650,7 +653,6 @@ func gotNACK(conn *rtpDownConnection, track *rtpDownTrack, p *rtcp.TransportLaye
|
||||||
log.Printf("WriteRTP: %v", err)
|
log.Printf("WriteRTP: %v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
track.rate.Accumulate(uint32(l))
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,6 @@ func sendKeyframe(kf []uint16, track conn.DownTrack, cache *packetcache.Cache) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
track.Accumulate(uint32(bytes))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +320,6 @@ func rtpWriterLoop(writer *rtpWriter, up *rtpUpConnection, track *rtpUpTrack) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
l.Accumulate(uint32(bytes))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue