From 49195ef9908918e7179741025a5ea2371392d3b0 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 29 May 2020 18:07:46 +0200 Subject: [PATCH] Improve error handling in sendPLI. --- client.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index bcb18e4..0551ddb 100644 --- a/client.go +++ b/client.go @@ -886,14 +886,17 @@ func updateUpBitrate(up *upConnection, maxVideoRate uint64) { } } +var ErrUnsupportedFeedback = errors.New("unsupported feedback type") +var ErrRateLimited = errors.New("rate limited") + func (up *upConnection) sendPLI(track *upTrack) error { if !track.hasRtcpFb("nack", "pli") { - return nil + return ErrUnsupportedFeedback } last := atomic.LoadUint64(&track.lastPLI) now := mono.Microseconds() if now >= last && now-last < 200000 { - return nil + return ErrRateLimited } atomic.StoreUint64(&track.lastPLI, now) return sendPLI(up.pc, track.track.SSRC())