Commit 50982fdd authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Forward received FIR to sender.

It would be better to terminate FIR, note that a keyframe was requested,
and send FIR on our own.
parent d56628be
...@@ -807,6 +807,9 @@ func (track *rtpDownTrack) updateRate(loss uint8, now uint64) { ...@@ -807,6 +807,9 @@ func (track *rtpDownTrack) updateRate(loss uint8, now uint64) {
} }
func rtcpDownListener(conn *rtpDownConnection, track *rtpDownTrack, s *webrtc.RTPSender) { func rtcpDownListener(conn *rtpDownConnection, track *rtpDownTrack, s *webrtc.RTPSender) {
var gotFir bool
lastFirSeqno := uint8(0)
for { for {
ps, err := s.ReadRTCP() ps, err := s.ReadRTCP()
if err != nil { if err != nil {
...@@ -823,6 +826,39 @@ func rtcpDownListener(conn *rtpDownConnection, track *rtpDownTrack, s *webrtc.RT ...@@ -823,6 +826,39 @@ func rtcpDownListener(conn *rtpDownConnection, track *rtpDownTrack, s *webrtc.RT
if err != nil { if err != nil {
log.Printf("sendPLI: %v", err) log.Printf("sendPLI: %v", err)
} }
case *rtcp.FullIntraRequest:
found := false
var seqno uint8
for _, entry := range p.FIR {
if entry.SSRC == track.track.SSRC() {
found = true
seqno = entry.SequenceNumber
break
}
}
if !found {
log.Printf("Misdirected FIR")
continue
}
increment := true
if gotFir {
increment = seqno != lastFirSeqno
}
gotFir = true
lastFirSeqno = seqno
err := conn.remote.sendFIR(
track.remote, increment,
)
if err == ErrUnsupportedFeedback {
err := conn.remote.sendPLI(track.remote)
if err != nil {
log.Printf("sendPLI: %v", err)
}
} else if err != nil {
log.Printf("sendFIR: %v", err)
}
case *rtcp.ReceiverEstimatedMaximumBitrate: case *rtcp.ReceiverEstimatedMaximumBitrate:
track.maxREMBBitrate.Set( track.maxREMBBitrate.Set(
p.Bitrate, mono.Microseconds(), p.Bitrate, mono.Microseconds(),
......
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