Commit a74e4f68 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't honour NACKs if we're congested.

parent 5a1ef1dd
...@@ -608,7 +608,11 @@ func rtcpDownListener(g *group, conn *downConnection, track *downTrack, s *webrt ...@@ -608,7 +608,11 @@ func rtcpDownListener(g *group, conn *downConnection, track *downTrack, s *webrt
} }
} }
case *rtcp.TransportLayerNack: case *rtcp.TransportLayerNack:
sendRecovery(p, track) maxBitrate := track.maxBitrate.Get(msSinceEpoch())
bitrate := track.rate.Estimate()
if uint64(bitrate) < maxBitrate {
sendRecovery(p, track)
}
} }
} }
} }
...@@ -720,17 +724,19 @@ func sendRecovery(p *rtcp.TransportLayerNack, track *downTrack) { ...@@ -720,17 +724,19 @@ func sendRecovery(p *rtcp.TransportLayerNack, track *downTrack) {
for _, nack := range p.Nacks { for _, nack := range p.Nacks {
for _, seqno := range nack.PacketList() { for _, seqno := range nack.PacketList() {
raw := track.remote.cache.Get(seqno) raw := track.remote.cache.Get(seqno)
if raw != nil { if raw == nil {
err := packet.Unmarshal(raw) continue
if err != nil { }
continue err := packet.Unmarshal(raw)
} if err != nil {
err = track.track.WriteRTP(&packet) continue
if err != nil { }
log.Printf("%v", err) err = track.track.WriteRTP(&packet)
} if err != nil {
track.rate.Add(uint32(len(raw))) log.Printf("%v", err)
continue
} }
track.rate.Add(uint32(len(raw)))
} }
} }
} }
......
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