Commit 0c7b77d9 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Only send RTCP feedback if supported by the peer.

parent fd6b9f6b
...@@ -755,6 +755,9 @@ func updateUpBitrate(up *upConnection, maxVideoRate uint64) { ...@@ -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 { ...@@ -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) { ...@@ -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
......
...@@ -64,6 +64,15 @@ func (up *upTrack) getLocal() []*downTrack { ...@@ -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
......
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