mirror of
https://github.com/jech/galene.git
synced 2024-12-22 23:35:46 +01:00
Only send RTCP feedback if supported by the peer.
This commit is contained in:
parent
fd6b9f6bdd
commit
0c7b77d919
2 changed files with 18 additions and 0 deletions
|
@ -755,6 +755,9 @@ func updateUpBitrate(up *upConnection, maxVideoRate uint64) {
|
|||
}
|
||||
|
||||
func (up *upConnection) sendPLI(track *upTrack) error {
|
||||
if !track.hasRtcpFb("nack", "pli") {
|
||||
return nil
|
||||
}
|
||||
last := atomic.LoadUint64(&track.lastPLI)
|
||||
now := mono.Microseconds()
|
||||
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 {
|
||||
if !track.hasRtcpFb("nack", "") {
|
||||
return nil
|
||||
}
|
||||
err := sendNACK(up.pc, track.track.SSRC(), first, bitmap)
|
||||
if err == nil {
|
||||
track.cache.Expect(1 + bits.OnesCount16(bitmap))
|
||||
|
@ -1201,6 +1207,9 @@ func sendRateUpdate(c *client) {
|
|||
for _, u := range c.up {
|
||||
updateUpBitrate(u, maxVideoRate)
|
||||
for _, t := range u.tracks {
|
||||
if !t.hasRtcpFb("goog-remb", "") {
|
||||
continue
|
||||
}
|
||||
bitrate := t.maxBitrate
|
||||
if bitrate == ^uint64(0) {
|
||||
continue
|
||||
|
|
9
group.go
9
group.go
|
@ -64,6 +64,15 @@ func (up *upTrack) getLocal() []*downTrack {
|
|||
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 {
|
||||
id string
|
||||
label string
|
||||
|
|
Loading…
Reference in a new issue