1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 08:35:57 +01:00

Only send RTCP feedback if supported by the peer.

This commit is contained in:
Juliusz Chroboczek 2020-05-09 18:49:22 +02:00
parent fd6b9f6bdd
commit 0c7b77d919
2 changed files with 18 additions and 0 deletions

View file

@ -755,6 +755,9 @@ func updateUpBitrate(up *upConnection, maxVideoRate uint64) {
} }
func (up *upConnection) sendPLI(track *upTrack) error { func (up *upConnection) sendPLI(track *upTrack) error {
if !track.hasRtcpFb("nack", "pli") {
return nil
}
last := atomic.LoadUint64(&track.lastPLI) last := atomic.LoadUint64(&track.lastPLI)
now := mono.Microseconds() now := mono.Microseconds()
if now >= last && now-last < 200000 { if now >= last && now-last < 200000 {
@ -780,6 +783,9 @@ func sendREMB(pc *webrtc.PeerConnection, ssrc uint32, bitrate uint64) error {
} }
func (up *upConnection) sendNACK(track *upTrack, first uint16, bitmap uint16) error { func (up *upConnection) sendNACK(track *upTrack, first uint16, bitmap uint16) error {
if !track.hasRtcpFb("nack", "") {
return nil
}
err := sendNACK(up.pc, track.track.SSRC(), first, bitmap) err := sendNACK(up.pc, track.track.SSRC(), first, bitmap)
if err == nil { if err == nil {
track.cache.Expect(1 + bits.OnesCount16(bitmap)) track.cache.Expect(1 + bits.OnesCount16(bitmap))
@ -1201,6 +1207,9 @@ func sendRateUpdate(c *client) {
for _, u := range c.up { for _, u := range c.up {
updateUpBitrate(u, maxVideoRate) updateUpBitrate(u, maxVideoRate)
for _, t := range u.tracks { for _, t := range u.tracks {
if !t.hasRtcpFb("goog-remb", "") {
continue
}
bitrate := t.maxBitrate bitrate := t.maxBitrate
if bitrate == ^uint64(0) { if bitrate == ^uint64(0) {
continue continue

View file

@ -64,6 +64,15 @@ func (up *upTrack) getLocal() []*downTrack {
return local return local
} }
func (up *upTrack) hasRtcpFb(tpe, parameter string) bool {
for _, fb := range up.track.Codec().RTCPFeedback {
if fb.Type == tpe && fb.Parameter == parameter {
return true
}
}
return false
}
type upConnection struct { type upConnection struct {
id string id string
label string label string