mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +01:00
Implement sendFIR.
This commit is contained in:
parent
49195ef990
commit
88fbce262f
3 changed files with 38 additions and 0 deletions
35
client.go
35
client.go
|
@ -908,6 +908,41 @@ func sendPLI(pc *webrtc.PeerConnection, ssrc uint32) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (up *upConnection) sendFIR(track *upTrack, increment bool) error {
|
||||||
|
// we need to reliably increment the seqno, even if we are going
|
||||||
|
// to drop the packet due to rate limiting.
|
||||||
|
var seqno uint8
|
||||||
|
if increment {
|
||||||
|
seqno = uint8(atomic.AddUint32(&track.firSeqno, 1) & 0xFF)
|
||||||
|
} else {
|
||||||
|
seqno = uint8(atomic.LoadUint32(&track.firSeqno) & 0xFF)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !track.hasRtcpFb("ccm", "fir") {
|
||||||
|
return ErrUnsupportedFeedback
|
||||||
|
}
|
||||||
|
last := atomic.LoadUint64(&track.lastFIR)
|
||||||
|
now := mono.Microseconds()
|
||||||
|
if now >= last && now-last < 200000 {
|
||||||
|
return ErrRateLimited
|
||||||
|
}
|
||||||
|
atomic.StoreUint64(&track.lastFIR, now)
|
||||||
|
return sendFIR(up.pc, track.track.SSRC(), seqno)
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendFIR(pc *webrtc.PeerConnection, ssrc uint32, seqno uint8) error {
|
||||||
|
return pc.WriteRTCP([]rtcp.Packet{
|
||||||
|
&rtcp.FullIntraRequest{
|
||||||
|
FIR: []rtcp.FIREntry{
|
||||||
|
rtcp.FIREntry{
|
||||||
|
SSRC: ssrc,
|
||||||
|
SequenceNumber: seqno,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func sendREMB(pc *webrtc.PeerConnection, ssrc uint32, bitrate uint64) error {
|
func sendREMB(pc *webrtc.PeerConnection, ssrc uint32, bitrate uint64) error {
|
||||||
return pc.WriteRTCP([]rtcp.Packet{
|
return pc.WriteRTCP([]rtcp.Packet{
|
||||||
&rtcp.ReceiverEstimatedMaximumBitrate{
|
&rtcp.ReceiverEstimatedMaximumBitrate{
|
||||||
|
|
2
conn.go
2
conn.go
|
@ -31,6 +31,8 @@ type upTrack struct {
|
||||||
jitter *jitter.Estimator
|
jitter *jitter.Estimator
|
||||||
maxBitrate uint64
|
maxBitrate uint64
|
||||||
lastPLI uint64
|
lastPLI uint64
|
||||||
|
lastFIR uint64
|
||||||
|
firSeqno uint32
|
||||||
lastSenderReport uint32
|
lastSenderReport uint32
|
||||||
lastSenderReportTime uint32
|
lastSenderReportTime uint32
|
||||||
|
|
||||||
|
|
1
group.go
1
group.go
|
@ -112,6 +112,7 @@ func addGroup(name string, desc *groupDescription) (*group, error) {
|
||||||
{"goog-remb", ""},
|
{"goog-remb", ""},
|
||||||
{"nack", ""},
|
{"nack", ""},
|
||||||
{"nack", "pli"},
|
{"nack", "pli"},
|
||||||
|
{"ccm", "fir"},
|
||||||
},
|
},
|
||||||
"",
|
"",
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue